Now that's a DIP that could use some love

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 17 21:55:22 UTC 2020


On 9/17/20 5:39 PM, Jonathan M Davis wrote:
> private traits in the public constraints. But even then, the actual template
> constraints are pretty short, and the traits used are descriptive enough
> that I wouldn't expect them to be hard to understand or that repeating them
> in English text would help much.

Here goes, straight from the horse's mouth 
(https://dlang.org/library/std/algorithm/iteration/each.each.html):

Flag!"each" each(Range) (
   Range r
)
if (!isForeachIterable!Range && (isRangeIterable!Range || 
__traits(compiles, typeof(r.front).length)));

Flag!"each" each(Iterable) (
   auto ref Iterable r
)
if (isForeachIterable!Iterable || __traits(compiles, 
Parameters!(Parameters!(r.opApply))));

Compare to "`each` requires type MyRange to work with foreach".

Let's see:

"pretty short" .................................................. FAIL
"descriptive enough" ............................................ FAIL
"wouldn't expect them to be hard to understand"  ................ FAIL
"repeating them in English text wouldn't help much" ............. FAIL


More information about the Digitalmars-d mailing list