Mixed int/BigInt foreach interval

Don nospam at nospam.com
Mon Sep 26 23:12:03 PDT 2011


On 27.09.2011 04:08, Simen Kjaeraas wrote:
> On Tue, 27 Sep 2011 03:38:11 +0200, Jonathan M Davis
> <jmdavisProg at gmx.com> wrote:
>
>> isIntegral was specifically designed for testing that a type was
>> one of byte, ubyte, short, ushort, int, uint, long, and ulong, and that's
>> exactly what it's doing.
>
> The name indicates it checks for generic integral-ness, not for built-in
> types.
>
> Given that changing isIntegral is likely to break a lot of code (is it?),
> perhaps we should also add behavesLikeIntegral, which checks for behavior
> instead of concrete types.

Well, actually BigInt behaves like an integer, unlike the built-in 
types, which don't <g>.

BigInt and the built-ins have quite different semantics. But there is 
also a substantial overlap. We definitely need some generic check for 
that common subset of functionality.
Another interesting case is a FixedLengthInt, which follows the same 
arithmetic as the built-in types, but isn't built-in.


More information about the Digitalmars-d mailing list