safer casts - take II

terranium spam at here.lot
Tue May 13 12:35:52 PDT 2008


Yigal Chripun Wrote:

> You want the RTTI cast to throw on error.
> it adds a performance penalty

I don't think so. How does it add a performance penalty?

> this current proposal suits everyone in that you can simply define a
> template my_cast that will call the cast(T) operator and on null will
> throw an exception.

There is no need for proposals to implement such a template. My reason is to force people to use safe cast, if you just write safe cast with template function, ugly syntax, ugly name, performance penalty (additional check for null) - no one will use it, even I.



More information about the Digitalmars-d mailing list