4 ms·
What 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 se
by Lramseyer 5y ago
What 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.