D const design rationale
Derek Parnell
derek at nomail.afraid.org
Wed Jun 27 01:09:05 PDT 2007
On Wed, 27 Jun 2007 03:18:58 -0400, Robert Fraser wrote:
> I don't like "view"... it's too verby and doesn't really imply "you can't touch this" to me.
> readonly gets my vote, but then again, Walter was able to put const/final/invariant
> into D without adding a new keyword. On the other hand, he _did_ add ref when
> a more descriptive one (inout) was already in use... but that's a different issue.
Let's face it, there isn't a single word in English that means "write
access for you using this symbol is denied" which is what the 'const'
keyword is trying to express.
If we really must use 'const' (and I'm pretty sure Walter ain't ever, ever,
ever going to change his mind) we must start thinking of it as meaning
'constrained' rather than 'constant'. That is, our access to the data
represented by the symbol is constrained to just being able to look at it.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
27/06/2007 6:03:39 PM
More information about the Digitalmars-d
mailing list