crazy tuple ideas.

Daniel Keep daniel.keep.lists at gmail.com
Fri Mar 2 22:12:58 PST 2007



Knud Soerensen wrote:
> With people starting to write compiler time parsers, 
> maybe it would be a good idea to have a standard way for
> representing syntax trees.
> 
> By allowing tuples to contain tuples we will have something 
> very similar to the lisp list expression. 
> Example:
> Tuple!(=,E,Tuple!(*,m,Tuple!(^,c,2))); // E=m*c^2;
> or maybe allowing the programmer to write just 
> (=,E,(*,m,(^,c,2)))
> 
> By using a standard way for representing syntax trees 
> we allow for more code sharing between project which 
> uses them.
> 
> Also if the D compiler made the programs syntax tree
> available doing compilation if would be possible to make 
> modules which could modify the programs syntax tree at compiler time.

+1 on nested tuples, although the symbols appearing unquoted is somewhat
iffy.

That said, I've always thought that parentheses should be the syntax for
instantiating tuples.  After all, everywhere parentheses are used, you
could conceivably put a tuple instead (and they would still work for
operation precedence since you'd need to evaluate a tuple's contents
before you could build the tuple).

Meh; just rambling.

	-- Daniel

-- 
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/



More information about the Digitalmars-d mailing list