tail const
so
so at so.do
Wed Dec 1 02:56:58 PST 2010
> Speaking about D mistakes Steve spoke about missing tail const.
> I was thinking about this, and I fully agree that it is a hole.
> I don't know if it was already discussed, but I was thinking that one
> could introduce
> *const T t1;
> and
> *immutable T t2;
Sorry if i am overlooking something but if we are going that far, why not
just :
const(int)* p; // tail const pointer - already here
const(int)& r; // tail const reference - will be introduced and quite
straightforward.
> One can see that this tail const is really a common type, indeed string
> is such a type, and a function can be pure even if its arguments is
> *immutable, because any changes would be done to a local copy in the
> function.
> I think that these things point toward the usefulness of a *const and
> *immutable attributes.
It is indeed common and IMHO it is the biggest reason why pointers are
still used too much in C++ where references should be the obvious choice.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list