const

Don Clugston dac at nospam.com.au
Wed Apr 2 04:14:51 PDT 2008


Janice Caron wrote:
> On 31/03/2008, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
>>  And while on the subject of "readonly", am I misreading this or is
>>  Walter basically the *only* one who thinks this sounds like it means
>>  "does not change ever".
> 
> I've never heard anyone but Walter make that claim.

Ditto. Come on, even non-programmers know what "read only access" means.
I find it hard to believe there would be many people who'd have trouble grasping 
the idea that "read only" means "look but don't touch". Are there any languages 
where 'readonly' is used for putting values into ROM? Even if so, it doesn't 
seems like a difficult thing to unlearn. But look at the number of people on 
this NG for whom 'const' intuitively means 'constant, like pi'.

Seriously, I think Walter's worrying about people who are fictional.

The best argument for const IMHO is terminology. C++ programmers are used to 
talking about "const correctness". But since that's only logical const, it's not 
a strong argument; it creates false expectations. By the time D has the whole 
shebang with pure functions, we'll want to use our terminology anyway.

And the name length is the second best argument.

> I, for one, would be /much/ happier with "readonly" or "ro" (or both -
> there's a thought), than "const", to mean "read only view"

Agreed.



More information about the Digitalmars-d mailing list