proposal: generic tupleof property for expressions
Don Clugston
dac at nospam.com.au
Mon Apr 30 05:14:54 PDT 2007
Downs wrote:
> I think D could be made much more powerful by extending the tupleof
> property
> (or a new property) to arbitrary expressions, similar to stringof, along
> the lines of
>
> (func(a, b)).tupleof resulting in a tuple like Tuple!(int function(int,
> int), (a, b)).
>
> Or deeper: ((a+b)*c).tupleof == Tuple!(int function(int, int), ((int
> function(int, int), a, b), c));
Currently tuples can't be nested; they automatically flatten. You can't
have a tuple inside a tuple.
What are 'a' and 'b' inside the tuple? Are they types, aliases, or values?
eg
int a;
const int b=7;
alias c a;
What would ((a+b)*c).tupleof return?
> From what I can see, that would allow D to evaluate arbitrarily complex
> expressions with the minimal amount of language change.
> And it also looks a bit like LISP :p
>
> Whaddya think?
>
> -- greetings, downs
More information about the Digitalmars-d
mailing list