const question/suggestion
Tristam MacDonald
swiftcoder at gmail.com
Wed Jun 20 16:10:26 PDT 2007
Bill Baxter Wrote:
> I would prefer something like that. I still can't get over the feeling
> anytime I type or see "cast" that I'm doing something dangerous and
> subversive. Although I know things like cast(ClassType) in D are
> actually safe casts... but even using safe casts like that is kind of a
> warning sign in OO code that you may have factored your interface
> incorrectly.
>
> --bb
I wouldn't say cast(const) was a OO problem - and the syntax is definitely improved over C++'s const_cast<ClassName>(), but it does point to 'C++ like' problems with how const works. I always thought the theory was that const_cast was there for dealing with legacy API's, not to overcome shortcomings in the language :)
More information about the Digitalmars-d-announce
mailing list