<div><div class="gmail_quote">On Mon, Jun 10, 2013 at 2:19 AM, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Timothee Cour:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A)<br>
I'd like to simplify notation of template function declarations involving<br>
only single-argument boolean template constraints as follows:<br>
<br>
example:<br>
A1: 'auto myfunction ( isSomeString a, isInputRange b) {...}'<br>
<br>
would be rewritten by compiler as:<br>
A2: 'auto myfunction(T0,T1) (T0 a, T1 b) if(isSomeString!T1 a &&<br>
isInputRange!T b) {...}'<br>
<br>
IMO, A1 is less verbose and clearer than A2.<br>
<br>
Obviously, more complex template constraints would still require the full<br>
syntax, but I'd argue this case is the most common.<br>
</blockquote>
<br></div>
See:<br>
<a href="http://forum.dlang.org/thread/xaganckgcdkfcmjamogh@forum.dlang.org" target="_blank">http://forum.dlang.org/thread/<u></u>xaganckgcdkfcmjamogh@forum.<u></u>dlang.org</a></blockquote><div><br></div><div>ah, great! So I guess it must indeed be a good idea!<div>
<div><br></div><div>from the link:</div><div>>  If you have two or more types, they must be the same (if you don't want this, you have to use the normal longer syntax)</div><div><br></div><div>In what I suggest, the restriction is much weaker so it'd be more generally applicable: for example, 'auto myfunction ( isSomeString a, isInputRange b)' would work in what I suggest but not with the proposal in the link. I don't think it adds any confusion.</div>
<div><br></div><div>Should I draft a DIP?</div><div>I'd like to get more feedback before though.</div><div><br></div><div><br></div><div>I'll also reply on the above link (CppNow 2013) for your second proposal from cppnow (i think variant does already that).</div>
<div><br></div></div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
B)<br>
Secondly, ddoc doesn't generate template constraints or does so very<br>
inconsistently :<br>
in <a href="http://dlang.org/phobos/std_algorithm.html" target="_blank">http://dlang.org/phobos/std_<u></u>algorithm.html</a> we have:<br>
template map(fun...) if (fun.length >= 1);<br>
but all other template constraints are omitted, eg:<br>
void fill(Range, Value)(Range range, Value filler); // template constraint<br>
omitted.<br>
Using the notation proposed in A, wherever applicable, would make documentation clear.<br>
</blockquote>
<br></div>
That sounds like a bug report for bugzilla.<br></blockquote><div><br></div><div>just filed: <a href="http://d.puremagic.com/issues/show_bug.cgi?id=10325">http://d.puremagic.com/issues/show_bug.cgi?id=10325</a></div><div>
<br></div></div></div>