shouting versus dotting
Benji Smith
dlanguage at benjismith.net
Mon Oct 6 04:06:06 PDT 2008
Andrei Alexandrescu wrote:
> I'd want to give it a try. How do others feel about Template{arguments}?
At first glance, I like it better than !(), especially since it saves a
character, making nested templates much nicer:
auto map = new Map{T[], List{MyType}}(); // not too bad
auto map = new Map!(T[], List!(MyType))(); // not too good
auto map = new Map<T[], List<MyType>>(); // still my favorite
It's too bad the shift operators can't be changed. Personally, I think
the angle brackets are more valuable as a matched pair of enclosures.
We could redefine the shift operators to be:
--> RIGHT SHIFT
<-- LEFT SHIFT
-->> SIGNED RIGHT SHIFT
And then the angle brackets could be coopted for templates.
Of course, like I said before, I think it'd be especially cool if
templates, as such, didn't exist. Instead, what if an ordinary function
could return a Type, which could be used in a Type Constructor?
Templates would vanish! It'd be CTFE, but for types instead of just for
values.
--benji
More information about the Digitalmars-d
mailing list