[Proposal]
Walter Bright
newshound at digitalmars.com
Sun Jun 18 01:51:36 PDT 2006
Sean Fritz wrote:
>> T sqr(T) ( T x )
>> {
>> return x*x;
>> }
>
> Is the way Java Generics do it,
I didn't think Java supported function templates (only class templates).
> and there is no problem parsing it,
That's true, although it requires arbitrary lookahead, which isn't a
significant problem.
> as it also
> explicitly introduces T, but there may be arguments made that sqr(T)(T x) is
> harder to read because it depends on context instead of explicit declaration.
> The context is a bit harder to notice in this case due to using () as template
> delimiters instead of < >.
The < and > cause a lot more ambiguity problems than they solve.
More information about the Digitalmars-d
mailing list