6 ms·
TclTutor 3: Computer aided instruction package for learning the Tcl language
- cmacleod4 5y agoNote that a web-enabled version can be found at the end of page https://wiki.tcl-lang.org/page/Tcl+Tutor https://wiki.tcl-lang.org/page/Tcl+Tutor
- wildzzz 5y agoCan anyone remind me what Tcl is good for anymore? I know a lot of EDA tools use it as the backend for builds but once the software writes the Tcl script for me, I've never had to make any changes to it more complex than variable names or options.
- NonEUCitizen 5y agoThe test suite for SQLite is written in Tcl. It's also an option for customizing Fossil SCM installations.
- bch 5y agoSame for various GNU[0] test requirements (DejaGnu[1]). Tcl at its core[2]. [0] https://www.gnu.org/software/automake/manual/1.16.1/html_node/DejaGnu-Tests.html https://www.gnu.org/software/automake/manual/1.16.1/html_nod... [1] https://www.gnu.org/software/dejagnu/manual/index.html https://www.gnu.org/software/dejagnu/manual/index.html [2] https://en.wikipedia.org/wiki/DejaGnu https://en.wikipedia.org/wiki/DejaGnu
- kodah 5y agoTCL is also used in a lot of bots
- Q6T46nT668w6i3m 5y agoTk
- kevin_thibedeau 5y agoMoreover, every Python installation with Tkinter has Tcl built in. You can directly interact with that Tcl interpreter from the Python side.
- bch 5y ago“Tcl tends to get ported to weird places like routers.” -Larry Wall (inventor of Perl), on Usenet.
- blacksqr 5y agohttps://wiki.tcl-lang.org/page/Who+says+Tcl+rules%2E%2E%2E https://wiki.tcl-lang.org/page/Who+says+Tcl+rules%2E%2E%2E
- kevin_thibedeau 5y agoIt is homoiconic without parenthesis soup. It also supports removing commands to the point of being non-Turing complete. That makes it useful as a configuration language for non-trusted input that can be extended as needed.
- na85 5y agoI've been writing a lot of lisp lately, and I don't know that homoiconicity is in and of itself a virtue. It's nice to have, I suppose, but I don't see what it really brings to the table other than a time-saving hack for reading configuration from disk.
- skissane 5y agoI don't think homoiconicity itself is the most important thing. I think the real power of Lisp comes from a bunch of other features, and a non-homoiconic language would be approximately equal in power to Lisp if it had these features: 1) A public API for manipulating the AST in the standard library. Most languages have some AST API defined as internals of their compiler/interpreter, but it is a private API, not a public API in their standard library. (Lisp's AST is almost trivial; but a language could have some kind of complex ADT-based or object-oriented AST and it would still be okay, so long as the AST is a public API in the standard library.) 2) The AST should be extensible, so you can define new types of nodes. 3) Ability to write arbitrary code (compile-time macros) which gets executed at compile time, and which can read the AST, and generate a replacement AST. 4) Compile-time macros are written in the same language (or almost the same language) as runtime code, rather than some special language (compare the C preprocessor to C). 5) Some form of syntax extensibility 6) Code to execute at compile-time, new AST node types, syntax extensions, etc, can be defined in the same program which uses them, as opposed to being segregated to some kind of "compiler plugin" with some kind of special build process 7) Some kind of "quotation syntax", where you write some code, and instead of actually being compiled, instead code to generate its AST is compiled. For example, 1+1 might evaluate to 2, %ast(1+1) (to pick a possible syntax at random) might evaluate to the AST for 1+1. 8) Some kind of "backquote syntax", to make it easy to write code templates (this is basically just (6) with ability to make substitutions in a hygenic way). 9) All of the above should be able to expressed with syntactic succinctness. Don't be afraid to add special syntax, or even some embedded DSLs, if it makes the above easier to express. (For the language designer/implementor, much of this may simply be dogfooding point 5 above.) Now, homoiconicity means Lisp can give you (1)-(9) with less work (for the language implementor) than a non-homoiconic language might require. But not everyone likes the simplistic syntaxes which homoiconic languages tend to have, and there is no reason why a language with an Algol-like or C-like or Pascal-like syntax couldn't give you (1)-(9) as well, albeit with a bit more work. Indeed, if you took any existing language and added (1)–(9) to it (if any of them weren't already there), and made sure to do it in an easy to use way, you'd basically end up with a language roughly equivalent to Lisp in power.
- jodrellblank 5y agoSee https://news.ycombinator.com/item?id=4120200 https://news.ycombinator.com/item?id=4120200 article and discussion from 2012.
- frozenport 5y agoCertainly a trend to move away from it. For example, Amira is a package that has been around about 30 years and uses it to script rendering. On the other hand a competitor (Carl Zeiss), a decade ago did a rewrite of their software and choose python (among others) as a scripting language. Nikon also developed their own language that resembles basic/C#. Asking your users to script in TCL rather than something like python is sadistic, and a position advocated by aging neckbeards. https://www.thermofisher.com/us/en/home/electron-microscopy/products/software-em-3d-vis/amira-software.html https://www.thermofisher.com/us/en/home/electron-microscopy/...
- unfocussed_mike 5y ago> Asking your users to script in TCL rather than something like python is sadistic, and a position advocated by aging neckbeards. Right. It's almost impossible to reason about a language that has no meaningful grammar. Finding bugs is hard, automatically finding problems nearly impossible. Tcl did give us one important thing -- Tk -- via `wish`, which was an important step in informing how people might want to add GUIs to scripts. But actually still committing to teach it in this day and age is really perpetuating bad habits when there are better options out there -- even PowerShell is a better choice.
- auxym 5y agoEh, I don't know. I wouldn't choose Tcl today for such a use case, maybe Lua. But you could certainly do worse than Tcl. Like a half-thought out custom language. Anyone ever coded nastran DMAP? Or Tex macros? I'd be ecstatic to have TCL over that. I've seen a materials testing machine whose method to script custom test sequences was a "programming language" that was displayed as text but you couldn't actually type things in. You'd have to select constructs such as a for loop or conditional from a drop down box, then a dialog would appear asking you for the parameters of the loop (start, end, etc). Actually, I think I even prefer Tcl to Excel's VBA.
- CamperBob2 5y agoSome major FPGA tools still use it.
- forinti 5y agoIt's the fastest way to write an app with a GUI and you can easily make a Windows executable with only an 8MB overhead (with freewrap).
- Lramseyer 5y agoWhat is it good for, or what is it used for? I think Tcl's biggest downfall is the fact that it suffers from Excel syndrome in that It works well for a small set of problems and OK for a bigger set of tangential problems. Tcl is Tool Command Language, and it's pretty good at routing commands to all of your JTAG, GPIB, Serial port, and whatnot devices. It has a REPL that is easy to use, and sits in the same runtime as all of your code. You can kind of think of it as a shell terminal for your devices. It's also apparently pretty compact all things considered. But it's typing is about as strong as wet toilet paper, which is cool when you have commands to send, receive, and parse out. But since it's also a programming language, you get into situations where someone writes all of the code to communicate with all of the devices in a nice little mini-library for everyone else to use. Since Tcl is a programming language, everyone is expected to develop all of the test and debug code in TCL. For some projects, we'll prototype a feature in Tcl, but the firmware implementation will be way simpler and more concise. That's mostly because doing anything with an array, or any type of math function requires a mess of syntax. The quintessential example would be incrementing a value in an array. In C, it would look like: myArray[i]++; But in Tcl, it goes a little something like this: lset myArray $i [expr [lindex $myArray $i] + 1] Now imagine doing things with descriptive variable names and it gets pretty messy.
- ithkuil 5y agoTo add to the confusion what TCL calls arrays are not what other languages call arrays. The above syntax is needed for lists, not arrays. If you want to increment a value in a TCL array all you need to do is: incr myArray($i) However that array is basically a dictionary, a hash map of (integer in this example) keys to values.
- auxym 5y agoTCL associative arrays are hash maps that have to be global. They are definitely one of the worst part of the language. Most people use dicts on modern TCL instead.
- onedognight 5y agoI have always found the man page for TCL to be an amazingly concise description of the language. https://manpagez.com/man/n/Tcl/ https://manpagez.com/man/n/Tcl/
- throwamon 5y agoSeriously, why aren't more manpages like that. It even looks good, and I say that as someone who has a strong distaste for plain text. It reminds me of the most impressive linguistic feat someone's ever seen (although this one actually uses extra spaces...): https://news.ycombinator.com/item?id=28651093 https://news.ycombinator.com/item?id=28651093
- unfocussed_mike 5y ago
- skissane 5y agoSome languages have rather simple core syntax, such as Tcl, Lisp, Forth, M4 Other languages have much more complex core syntax, for example C family languages such as C or C++ or Java. Certain languages, such as COBOL or Perl, are at the extreme of core syntax complexity Separate from the core syntax, we can also speak of "non-core syntax" (which is expressed in terms of the core syntax), which can itself be quite complex whether or not the core syntax is – look at how complex many Tcl commands are; or consider some rich fluent Java API; or the Common Lisp loop macro You seem to be equating simple core syntax with no syntax. No language has no syntax; a language without syntax could not be a language.
- unfocussed_mike 5y agoI said nothing at all about syntax; of course it has syntax. Does Tcl have a grammar? There is a distinction and it is not irrelevant; you will run into the consequences of it. Markdown has syntax -- but no official grammar. I would not (sorry Mr Gruber) grant Markdown the privilege of being called a language in the same breath as even HTML. Markdown is a syntax looking for a grammar. So is Tcl. So the definition of Tcl is "what the Tcl interpreter can parse". Like the Apache config file "format" is defined only by what Apache can parse. (Curious to be downvoted for expressing what was -- twenty five, twenty years ago -- quite a big deal in scripting language circles. Tcl's lack of a grammar up against Scheme, Lisp, etc., was a point of some contention. Either way it is precisely why sane developers do not use Tcl.)
- skissane 5y ago> Does Tcl have a grammar? There is a distinction and it is not irrelevant; you will run into the consequences of it. Aren't syntax and grammar synonymous? Or, if not exactly the same thing, essentially two sides of the same coin? In my mind, a syntax is a set of well-formed formulas, a proper subset of the Kleene star of the language's alphabet. And a grammar is basically the same thing. I suppose, beyond being a mere set of WFFs, both are also a mapping from formulas to some kind of tree structure; if we can give the set of WFFs a recursive definition, then a tree structure falls out of it naturally. But, Tcl obviously has a WFF-set and a tree structure. (Although, there are also different levels of WFF-sets – the set of all syntactically/grammatically valid C programs is a proper superset of the set of all semantically valid C programs – a C program which calls an undefined function might be said to be syntactically but not semantically valid – and surely the same point holds for Tcl as well.) > Markdown has syntax -- but no official grammar. If Markdown has "no official grammar", it is because there is not one thing called Markdown, there are many. It is many sets of well-formed formulas, which are very disjoint. I suppose almost every language is many rather than one, because every implementation of a language adds a slightly different set of non-standard extensions; but in languages such as C, those differences are confined to relatively narrow areas (such as pragmas, attributes, reserved names, etc); in languages such as Markdown, the syntactic differences between different implementations will be much more extensive, so much so that we are really talking about a family of related languages (flavours as they say), rather than a single one. > So is Tcl. So the definition of Tcl is "what the Tcl interpreter can parse". The core syntax of Tcl is reasonably fixed. An independent implementation can be written to accept exactly the same core syntax as the reference implementation does, without any great effort. The non-core syntax is (near-)infinitely flexible, but I could say the same thing about C or Java. In Tcl, I can define (near-)arbitrarily named commands that accept (near-)arbitrarily named arguments; in C/C++/Java/etc I can define (near-)arbitrarily named functions/methods which accept (near-)arbitrarily named arguments, (near-)arbitrarily named structs/classes/etc which have (near-)arbitrarily named fields, etc. > Tcl's lack of a grammar up against Scheme, Lisp, etc., was a point of some contention. That claim makes zero sense to me. Tcl and Lisp have core syntaxes based on rather different principles, but both have a grammar, and I don't think there is any sensible way in which you could say that one has more of a grammar than the other.
- smrtinsert 5y agoIs there a tcl implementation targeting javascript that has upvar and uplevel and can access javascript objects?