Live data from Hacker News

Tcl the Misunderstood (2006)

antirez.com

1–10 of 81 posts

Re: Tcl the Misunderstood (2006)

#2
> Every string is internally encoded in utf-8, all the string operations are Unicode-safe

This seems very slightly disingenuous, if my memory is correct. I don't remember all the details, but I ran into an issue with a Tcl application a while back and Unicode support. Digging into it, I recall that the Tcl interpreter actually represents every character as a predefined number of bytes, set by a preprocessor definition. The default was 2, and cut off any Unicode character that needed more than 2 bytes to encode, unless you were willing to recompile the interpreter to use 4 bytes, at the cost of doubling memory consumption for every string.

Very nitpicky, but I think it's important to point out it's not "quite" utf-8, because Tcl needs each codepoint to be O(1) indexable in an array, something normal utf-8 can't do.

Re: Tcl the Misunderstood (2006)

#4
post #2

> Every string is internally encoded in utf-8, all the string operations are Unicode-safe This seems very slightly disingenuous, if my memory is correct. I don't remember all the details, but I ran into an issue with a Tcl application a while back and Unicode support. Digging into it, I recall that the Tcl interpreter actually represents every character as a predefined number of bytes, set by a preprocessor definitio…

> Digging into it, I recall that the Tcl interpreter actually represents every character as a predefined number of bytes, set by a preprocessor definition.

Ah, that’s exactly what old python did. Wonder of it was inspired by the tcl solution.

Fwiw because they rejected indexing recent cpython uses a variable encoding based on contents (possibilities are iso-8859-1, ucs2, or ucs4). That does mean adding an astral codepoint to an ASCII string quadruples its size.

Pypy, on the other hand, uses utf-8.

Re: Tcl the Misunderstood (2006)

#5
What I like most about TCL is that a TCL REPL feels a lot more like a normal command prompt than Lua or Python or whatever. If I’m going to write a complex program, TCL wouldn’t be my first choice, but if a program I’m using has a command prompt (think autocad or the debug console a lot of games have). Plenty easy for one-off commands, but with a simple and powerful programming language there if you ever need it.

Put differently: The command line ergonomics of POSIX shell, with the scripting ergonomics of Lisp

Re: Tcl the Misunderstood (2006)

#7
The idea that Tcl was a toy came from the 90s and the Tcl Wars Stallman was involved with. But to Stallman, anything other than Lisp is pretty much a toy. Tcl is indeed a deep, deep rabbithole -- again, deeper than our dimension allows and lined with toothed cilia... but I can totally see where a person might look in Tcl's deadlights and want to be there.

Re: Tcl the Misunderstood (2006)

#8
post #6

Quoted post unavailable.

> On-Topic: Anything that good hackers would find interesting. That includes more than hacking and startups. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual curiosity.

From the HN Guidelines.

Note the lack of the pattern "new" anywhere in there.

Re: Tcl the Misunderstood (2006)

#9
TCL was my entry into coding back when I was a teenager, haven't touched it in over 12 years or so but I'll always fondly remember it. The title of this post is very familiar to me, I'm sure I read it back when it was published but its cool to now know it was written by the creator of redis which I now use extensively

Re: Tcl the Misunderstood (2006)

#10
I think it's worth pointing out that in the years since this article was written (2006) quite a few new features have been added to Tcl. A few of the more significant include coroutines, robust object-oriented system, tailcalls, apply (lambdas), namespace ensembles, et.al.

Of course some of these features were already present in other languages. However, steady improvements to Tcl have pushed the language well beyond how it was described in the article. Definitely not a "toy" but overall as capable as the other scripting tools out there.

Post reply on HN