Now that's a DIP that could use some love

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 17 21:47:53 UTC 2020


On 9/17/20 5:40 PM, H. S. Teoh wrote:
> How exactly does adding
> a string description to .each's sig constraints help in any way?
> Wouldn't they just repeat what the names of the clauses already say?

Emphatically NO!

How is this:

mymodule.d(4): Error: template onlineapp.main.each!((x) => 
writeln(x)).each cannot deduce function from argument types !()(int), 
candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(962): 
       each(Range)(Range r)
   with Range = int
   must satisfy one of the following constraints:
        isRangeIterable!Range
        __traits(compiles, typeof(r.front).length)
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(1023): 
        each(Iterable)(auto ref Iterable r)
   with Iterable = int
   must satisfy one of the following constraints:
        isForeachIterable!Iterable
        __traits(compiles, Parameters!(Parameters!(r.opApply)))

the same as this:

mymodule.d(42): "Attempting to use `each` with type `int`, which cannot 
be iterated using a foreach loop."

?

I mean how can anyone not chuckle at this crap? Did you guys gang on me 
with a prank?

https://run.dlang.io/is/cbO30I


More information about the Digitalmars-d mailing list