Const sucks

Janice Caron caron800 at googlemail.com
Tue Sep 11 01:25:10 PDT 2007


On 9/11/07, Janice Caron <caron800 at googlemail.com> wrote:
>
> It's simple, but - I would argue - the wrong choice. A better choice (in
> my humble opinion) would be
>
> const = constant
> readonly = read-only
>
> If it's not too late to change the keywords, that, to me, would be the way
> to go.
>


By which I mean, if it's at all feasable to consider ditching the keyword
"invariant" altogether, and introducing a new keyword "readonly", then let's
do it. "readonly" should indicate a read-only view of data which someone
else might modify, and "const" should imply that no-one can modify it ever,
no way, nohow.

I'm not quite sure why no one before now has suggested using "readonly" to
mean read-only and "const" to mean constant, but seems kind of a no-brainer
to me. You know - calling a thing what it is, instead of something it's not.
I know I'd be dead confused if int meant float, for example.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20070911/ac68abcc/attachment.html>


More information about the Digitalmars-d mailing list