Rant: Date and Time fall short of simplicity in D

Jesse Phillips Jessekphillips+D at gmail.com
Fri Mar 29 15:07:38 PDT 2013


On Friday, 29 March 2013 at 21:36:37 UTC, Steven Schveighoffer 
wrote:
> (and yes, casts are dangerous and should be avoided).

I think you are applying "common knowledge" to something where it 
doesn't apply.

auto foo = cast(TickDuration) bar;

This is not unsafe, unless you claim that opCast is being 
implemented in a dangerous manner (takes a Variant and converts 
it to 32)

I'm really confused on what your argument is. It sounds like you 
don't want to!() to be able and convert user types, but if it 
does than it shouldn't be allowed to use cast.

I'm not sure what issue you are expecting to prevent by requiring 
bar.toTickDuration() instead of using cast or to!().


More information about the Digitalmars-d mailing list