Mixed int/BigInt foreach interval

Mehrdad wfunction at hotmail.com
Mon Sep 26 18:33:22 PDT 2011


On 9/26/2011 2:25 PM, Jonathan M Davis wrote:
> What I probably meant to say was "Code could easily assume that..." 
> but you get the idea. Certainly, there's no question that there's code 
> out there that would be broken by such a change - including code in 
> Phobos. So, we need to be very careful about any such changes. But 
> since it would be easy to have a template constraint check 
> if(isIntegral!T || is(Unqual!T == BigInt)) I don't see much benefit in 
> making isIntegral return true for BigInt anyway. BigInt is _not_ the 
> same as the built-in integral types. Code which uses integral types 
> could easily not work with BigInt. Yes, there is plenty of code that 
> could work with both, but it needs to be designed with that level of 
> genericness in mind, and much of the code using isIntegral is _not_. - 
> Jonathan M Davis 
IMHO that's a pretty bad constraint check.

What it should instead be is something along the lines of:

isIntegral!T && isPrimitive!T


More information about the Digitalmars-d mailing list