Timothee Cour:

A)
I'd like to simplify notation of template function declarations involving
only single-argument boolean template constraints as follows:

example:
A1: 'auto myfunction ( isSomeString a, isInputRange b) {...}'

would be rewritten by compiler as:
A2: 'auto myfunction(T0,T1) (T0 a, T1 b) if(isSomeString!T1 a &&
isInputRange!T b) {...}'

IMO, A1 is less verbose and clearer than A2.

Obviously, more complex template constraints would still require the full
syntax, but I'd argue this case is the most common.

See:
http://forum.dlang.org/thread/[email protected]


B)
Secondly, ddoc doesn't generate template constraints or does so very
inconsistently :
in http://dlang.org/phobos/std_algorithm.html we have:
template map(fun...) if (fun.length >= 1);
but all other template constraints are omitted, eg:
void fill(Range, Value)(Range range, Value filler); // template constraint
omitted.
Using the notation proposed in A, wherever applicable, would make documentation clear.

That sounds like a bug report for bugzilla.

Bye,
bearophile

Reply via email to