Re: Syntax, expressiveness and the beauty of Tcl
- From: "Donal K. Fellows" <donal.k.fellows@xxxxxxxxx>
- Date: 30 Oct 2006 03:31:32 -0800
Stephan Kuhagen wrote:
It works this way also, but my point was to be able to write
: x=2+2
We'd really rather you didn't use ":" as the command name. Almost
anything else (including control characters!) would be better. This is
because "::" is used for a namespace separator and ":" on its own gets
tangled in that. It might be better to use something like this instead:
|- x=2+2
since it looks like the turnstile operator from mathematics (OK, you
can use the real turnstile character too, but that's trickier to write
in most editors).
The other problem with the syntax as it seems to be at the moment is
that not putting braces around it means that variable substitutions
happen at "the wrong time", meaning that they can change the sequence
of operators. (This was a common problem with [expr] usage in Tcl
scripts in the 7.* days, BTW.) There are ways to fix - e.g. treating
barewords as variable names - but they in turn reduce the ability of
your code to intermix smoothly with Tcl's basic syntax and you'll end
up having to put braces round things a lot anyway.
BTW, if you're going to do assignment, don't repeat BCPL's mistakes.
Use ":=" as the assignment operator.
Donal.
.
- Follow-Ups:
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Re: Syntax, expressiveness and the beauty of Tcl
- References:
- Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Re: Syntax, expressiveness and the beauty of Tcl
- From: suchenwi
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Syntax, expressiveness and the beauty of Tcl
- Prev by Date: Re: strings in TcL
- Next by Date: Re: Thoughts about the controversial {expand} feature
- Previous by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Next by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Index(es):