News for hackers. Stuff that matters.
Re:Tcl the misunderstood (2006) by ZoFreX on Friday December 14, 2012 @09:54AM (#4921145)
> curly brackets are syntactically significant in strings - and comments.

The latter trips me up far more than I would like to admit :(

It's a great example of the nature of Tcl as a language, though. Sometimes I love the simplicity, sometimes consequences of it drive me nuts.

For those who haven't used Tcl: You write comments like this:

    # this is a comment
But, in keeping with Tcl's simple and tiny nature, this isn't a special case. "#" is simply a procedure that ignores all arguments supplied to it!

While this is extremely elegant, and means you could implement comments in Tcl itself rather than the interpreter, it does mean that you have to balance your curly brackets within comments, which is hugely annoying when you forget.

Re:Tcl the misunderstood (2006) by rotskoff on Friday December 14, 2012 @09:59AM (#4921184)
I use Tcl for a number of analysis scripts inside some scientific software. Recently, I came across a situation in which I had nested loops:

    for {set i 0} {$i<$n} {incr i} {
        # Some comment
        for {set j 0} {$j<$n} {incr j} {
The script refused to run and eventually I figured out that the comment was somehow impeding execution. I still don't understand why.
Re:Tcl the misunderstood (2006) by engtech on Friday December 14, 2012 @02:46PM (#4922880)
This also breaks, because comments are syntax.

   proc some_proc {a b} {
   
   } # some_proc
Re:Tcl the misunderstood (2006) by vorg on Saturday December 15, 2012 @11:26PM (#4927327)
Based on the instructions in the article (tho I haven't tried it out), putting a semicolon before the hash would work...

    proc some_proc {a b} {
    
    } ;# some_proc
Re:Tcl the misunderstood (2006) by ZoFreX on Saturday December 15, 2012 @11:25AM (#4925554)
That's easier to explain though - you are passing the arguments {a b} { } # and some_proc to the procedure some_proc. Because comments are just another command, the # has to be the first non-whitespace character on the line.
Re:Tcl the misunderstood (2006) by ZoFreX on Saturday December 15, 2012 @11:25AM (#4925557)
Are you sure the comment didn't have some curly brackets in it or something like that?
Re:Tcl the misunderstood (2006) by ul5255 on Friday December 14, 2012 @12:25PM (#4922020)
To my best knowledge, the hash mark comments are parsed as comments by the Tcl parser. The interpreter will not execute a "hash mark" procedure. You can check for the parsing and semantics of Tcl by googling for "Tcl dodekalogue".