So what does (inout int = 0) do?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 15 06:27:57 PDT 2016


On Friday, 15 April 2016 at 09:07:27 UTC, Timon Gehr wrote:
> Related: Phobos should never use is(typeof(...)). Contrary to 
> popular belief, is(typeof(...)) is not the same as 
> __traits(compiles,...).


I don't think it should be using __traits(compiles) either. I'd 
prefer to see built from the other reflection primitives... 
though I'll grant that compiles is flexible.

hasMember!(Range, "empty")

isn't as specific as the current test... and

is(typeof(Range.init.empty) : bool)

isn't as flexible (I don't think that takes an empty that returns 
an opCast:bool item)


But regardless, I still kinda prefer the idea of building these 
reflection helper functions so they do cover the cases nicely...

then a helper function that takes a list of conditions and tells 
you which one failed... hmm, this is getting interesting.


More information about the Digitalmars-d mailing list