Mixed int/BigInt foreach interval

bearophile bearophileHUGS at lycos.com
Thu Sep 29 05:13:59 PDT 2011


Christophe:

> That seems to be a very reasonable workarround.
> Does
> foreach(i; (cast(T) 2) .. k+1) work ?

It seems to work. It is a variant I have not tried. Thank you. But probably I'll write a low-priority enhancement request any way.


> BigInt is in the library, not in the language. I hardly see a way the 
> compiler could optimize this.

The threshold between compiler and library is not fully sharp. Complex numbers will become fully library types. Associative arrays are mostly defined in D code, they have literals defined in the language. Both of them have changed their position. Hopefully D2 will add some syntax sugar to manage tuples a bit better (for their unpacking, mostly). So there are movements in both directions.

Bye,
bearophile


More information about the Digitalmars-d mailing list