dropping parentheses on template instantiation

David Wilson dw at botanicus.net
Sun Oct 5 12:24:07 PDT 2008


2008/10/5 Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
> I just realized something different. After making an informal review of some
> code, I saw that a large percentage of template instantiations only need ONE
> argument.
>
> This makes me think, with the old "!" notation, parentheses could be dropped
> entirely without prejudice:
>
> auto covariance = Matrix!real(n, n);
> auto normalized = SparseVector!double(n);


This looks more like output from a debugger than it does input for a
C-like compiler. :)

-1 from me.

>
> and so on.
>
> To the unbridled joy of the enemies of the Sad Pirate, the dot won't work
> for template instantiation because without the parentheses it DOES engender
> ambiguity.
>
> Now say we take the following route:
>
> 1) We find something different from shouting
>
> 2) We drop the parentheses for 1 argument
>
> That sounds like a possible winner. In this case the "#" becomes
> considerably more attractive, in fact very attractive exactly because it
> looks unlike any letter:
>
> auto covariance = Matrix#real(n, n);
> auto normalized = SparseVector#double(n);
>
> Ideas?
>
>
> Andrei
>
> P.S. The Sad Pirate is the emoticon
>
> .(
>
> It doesn't have an eye and is sad, too.
>



More information about the Digitalmars-d mailing list