Re: Syntax, expressiveness and the beauty of Tcl
- From: "slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx>
- Date: 31 Oct 2006 00:38:35 -0800
Stephan Kuhagen wrote:
slebetman@xxxxxxxxx wrote:
I will have a closer look into that, looks cool to me. Does your example
imply that the variable must exist before it can be used that way? This
would be very C-like, more that I expected... ;-)
No. 'Normal' variables don't inherit that behavior (for that you can
use the [unknown] trick). Instead the [var] command is used to create
C-like variables:
var x = 10
var y
x = $x * 2
y = $x * $x
x = $y
y = 0
puts $x
puts $y
Notice that since x and y are proper procs, they can also be used like
this:
y = [x]
x = [x] + [y]
but I think $x looks nicer than [x]. Besides, for me, in my code, [x]
signifies a constant (I use procs to define global constants).
.
- Follow-Ups:
- Re: Syntax, expressiveness and the beauty of Tcl
- From: slebetman@xxxxxxxxx
- 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: slebetman@xxxxxxxxx
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Re: Syntax, expressiveness and the beauty of Tcl
- From: slebetman@xxxxxxxxx
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- Syntax, expressiveness and the beauty of Tcl
- Prev by Date: Re: Dr. Dobb's Tcl-URL! - weekly Tcl news and links (Oct 31)
- Next by Date: Re: Syntax, expressiveness and the beauty of Tcl
- Previous by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Next by thread: Re: Syntax, expressiveness and the beauty of Tcl
- Index(es):
Relevant Pages
|