On 3/18/12, Manu <[email protected]> wrote:
> I'm finding that in this code I'm writing, casts are taking up more space
> on many lines than the actual term being assigned.

Another classic which fails to compile is:

import std.random;
ubyte c = uniform(0, 256);

In the call uniform returns a number anywhere from 0 to and including
255, which can fit perfectly in a ubyte. But I have to use a cast
(which is error-prone if I change the right interval), or use a
to!ubyte call (which is verbose). Granted for simple-purpose random
number generation a cast might be safe..

Reply via email to