dropping parentheses on template instantiation
Leandro Lucarella
llucax at gmail.com
Sun Oct 5 15:34:45 PDT 2008
Andrei Alexandrescu, el 5 de octubre a las 13:18 me escribiste:
> 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);
>
> 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?
I really liked downs idea, what about
auto covariance = Matrix of real(n, n);
auto normalized = SparseVector of double(n);
auto foo = Bar of (double, Foo)(n);
Or maybe reuse "with"?
auto covariance = Matrix with real(n, n);
auto normalized = SparseVector with double(n);
auto foo = Bar with (double, Foo)(n);
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
¿Qué será lo que hace que una brújula siempre marque el norte?
- Ser aguja, nada más, y cumplir su misión.
-- Ricardo Vaporeso
More information about the Digitalmars-d
mailing list