foo!(bar) ==> foo{bar}

Benji Smith dlanguage at benjismith.net
Wed Oct 8 09:09:20 PDT 2008


Andrei Alexandrescu wrote:
> One possibility to make progress would be to keep !( but allow omitting 
> the parens when only one argument is being passed. That way many 
> instantiations will be helped. For example, in wake of the impending 
> demise of complex built-ins:
> 
> Complex!double alpha;
> Complex!float[] data;

Is that an array of Complex!float, or a Complex of float-arrays?

In absence of parentheses, does the ! operator have higher precedence 
than square brackets?

Also...just thinking aloud...it occurs to me that arrays really ought to 
be templates, declared like this:

    Array!int integers;

The square-bracket declaration syntax is handy, but behind the scenes, 
is there really any difference between an array-of-a-specific-type and a 
template?

--benji



More information about the Digitalmars-d mailing list