Implicit enum conversions are a stupid PITA

bearophile bearophileHUGS at lycos.com
Thu Mar 25 13:08:26 PDT 2010


Adam D. Ruppe:

> Have the user switch over to the string notation in those rare cases.

OK.
But are you sure you want a template named just "O" in the std lib? Oct or Octal can cause less collisions.


> Another possibility might be having integer literals actually be infinite
> in size in the compiler, and use a template alias.. or something, to take
> them unmolested into CTFE for manipulation.
> 
> This would also be useful for bignum structs. You can just reuse the plain
> old integer literal when initalizing them.
> 
> Then, if the literal is too big to fit in the type requested, the compiler
> throws an error only at the last minute it can possibly check.

If this can work and be safe, then it's a cute idea.

Bye,
bearophile



More information about the Digitalmars-d mailing list