shouting versus dotting

Benji Smith dlanguage at benjismith.net
Tue Oct 7 07:39:09 PDT 2008


Andrei Alexandrescu wrote:
> b) Template at Arg and Template@(Args)
> 
> This approach not only accepts the need for a contraption, it actually 
> leverages it by allowing you to drop the parens if you only have one 
> argument. That way "@" becomes a true operator, the template 
> instantiation operator. Note that this can be done with the current "!" 
> as well, except that Template!Arg does not look to me like anything 
> enticing.

Interesting.

    // If this is possible.......
    auto myTemplate = Template @ (1, 2, 3, uint);

    // ......shouldn't this be possible too?
    auto args = (1, 2, 3, uint);
    auto myTemplate = Template @ args;

All other binary operators can operate on either a literal or on an 
expression, and I'd expect a template instantiation operator to do the same.

What do you think?

--benji



More information about the Digitalmars-d mailing list