Re: Syntax, expressiveness and the beauty of Tcl
- From: Fredderic <put_my_name_here@xxxxxxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 18:41:17 +1000
The point is, that it resembles the Tcl way better and is easier to
explain. In LISP, everything is prefix, so the (+ a b) is no surprise.
Tcl is similar regarding prefix operators. [expr] is the prefix
operator for math but inside it mixes infix notation in - which
differs from the philosophy of prefix operators that you have
everywhere else in Tcl.
I think having the math operators in their own namespace is a great
idea, especially if they take multiple arguments (eg. [+ 1 2 3 4 5]).
I've occasionally found it handy to have the basic maths ops as
commands, and having them pre-defined in the math ops namespace means I
don't have to re-define them myself anymore.
I also dislike it, because it introduces so many new commands and
will not stop to extend (and floating the namespace) with new
commands until all possible math expressions are included.
I've also rarely came across a situation where it matters if they're
stuck in their own namespace, because generally the [expr] command does
the job better anyhow. We'll probably run into that old [expr] problem
with double-evaluated arguments. So [tclmath::+] (or whatever it ends
up being) shouldn't often be a problem. And even when it is, you can
also quite easily pull just the ones you need into the local
namespace. People should be encouraged to leave room for these
operators, and pull them in from there rather than re-implementing them
themselves. Perhaps even provide a convenience function to do it.
Fredderic
.
- 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
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Kevin Kenny
- Re: Syntax, expressiveness and the beauty of Tcl
- From: MH
- Re: Syntax, expressiveness and the beauty of Tcl
- From: Stephan Kuhagen
- 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: strings in 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
|
|