May 15, 2008 Re: safer casts - take II | ||||
|---|---|---|---|---|
| ||||
Posted in reply to terranium | On 14/05/2008, terranium <spam@here.lot> wrote:
> BCS Wrote:
>
> > I guess if you can convince me that I am in the minority here
>
> In fact, I am the only who argued for throwing cast, it seems like everyone else is against my proposal, so the result is obvious.
I don't understand. In the next Phobos release, you will have your wish. to!(T) will work as a throwing dynamic cast. It looks to me like you've actually got what you wanted. What's the problem?
It would be very, very impractical to make cast(T) itself throw, because it would break a lot of a code. Obviously, my/Yigal's probosal will itself break lots of code, but in our case, the fix of adding an exclamation mark to the offending line will make it compile again, almost all of the time. But if cast(T) were to suddenly change its behavior to start throwing, there would be no compile errors for using it - just lots of runtime exceptions generated by existing code. And even once the cause is discovered, it's not clear how existing code would have to be rewritten in order to carry on working.
The way I see it, the fact that you've got to!(T) coming means that you can write your code in the way that you want it, but also so can everyone else. What's wrong with that?
| |||
June 10, 2008 Re: safer casts - take II | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | Bill Baxter wrote: > ask "Hey, object, do you implement the IHasCheezburger interface?" so ROFL, best interface name evar :P (it's funny *and* follows my preferred name conventions) -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply