shouting versus dotting
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Oct 7 08:33:25 PDT 2008
Benji Smith wrote:
> 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?
I think you will have a hard time (re)using parentheses and commas to
define literals.
Andrei
More information about the Digitalmars-d
mailing list