foo!(bar) ==> foo{bar}
Benji Smith
dlanguage at benjismith.net
Tue Oct 7 06:51:17 PDT 2008
Walter Bright wrote:
> The foo.(bar) syntax seems to be sinking. The foo{bar} seems to be the
> most practical alternative. So, how about putting it in the next D2
> release on a trial basis, so people can try it out and see how it looks?
Braces for template instantiation seem okay. But would there be any
change to template declaration syntax?
There's a conceptual symmetry between templates and functions, Both
having declarations and invocations. Functions use parens for both
cases, whereas templates use "()" at the declaration site and "!()" at
the invocation site.
I think the symmetry would be ideal, if bare parens were used in all
cases. But at least the "!()" syntax was somewhat reminiscent of the
declaration syntax (and the function invocation syntax).
Using curlies for template instantiation breaks the symmetry pretty
badly, unless the template declaration syntax also uses curlies.
--benji
More information about the Digitalmars-d
mailing list