Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen <nospam@xxxxxxxxxx>
- Date: Tue, 31 Oct 2006 06:44:25 +0100
Eckhard Lehmann wrote:
That all looks very weird and complex. What about a simple and strict
polish notation, like in LISP:
proc + {a b} {expr {$a + $b}}
proc - {a b} {expr {$a - $b}}
proc * {a b} {expr {$a * $b}}
proc / {a b} {expr {$a / $b}}
If you are used to LISP like languages, this is very straight forward, but
IMHO it has the disadvantage that you need to define a proc for every
operation you want to use. My first approach (which of course is far away
from being perfect as noted by others here and which is useless if you want
polish notation...) can simply use [expr], which gives you already a full
and effective expression parser, just with a very small extension to its
semantics. Maybe, this extension should be really part of [expr], so we can
write
expr {x=some_expr}
instead of
set x [expr {some_expr}]
Which IMHO would look very normal to many people, should be easy to
implement and saves you the [set]. OTOH "set..." has the advantage that you
easily can see, there is an assignment, which is what I generally like in
Tcl: WHAT is done come first. But "expr {x=some_expr}"... hm, I kind of
like that.
Stephan
.
- Follow-Ups:
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Donal K. Fellows
- 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: Christian Gollwitzer
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Eckhard Lehmann
- Syntax, expressiveness and the beauty of Tcl
- Prev by Date: Re: Syntax, expressiveness and the beauty of Tcl
- 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
|