safer casts - take II

Dee Girl deegirl at noreply.com
Tue May 13 12:22:06 PDT 2008


BCS Wrote:

> Reply to Yigal,
> 
> > I don't add this to the "official" proposal yet, this is still just
> > some
> > thoughts not finalized into anything formal.
> > feel free to discuss this and propose names for the strong_cast!(T)
> > template.
> 
> force_cast!(T)
> 
> and I'd put them in object.d

What is object.d please?

Only now I understood something. It was in a early post. There is enforce already in std.contracts. Then enforce(cast(T) x) works. It is longer than force_cast!(T) x. But I prefer it because it respects composition principle. If I know what cast does and what enforce does then I know what enforce(cast(T) x) does. Thank you, Dee Girl



More information about the Digitalmars-d mailing list