const

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 2 07:39:35 PDT 2008


"Bill Baxter" 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 think if you did a study asking programmers to rank the 
> unchanging-ness of various const words, you'd get a result with "readonly" 
> coming out much weaker than "constant".  The fact that all the words mean 
> effectively the same thing does not mean that everyone perceives the 
> nuances in the same way.  And if an overwhelming majority perceive 
> "readonly" to have weaker meaning than "constant" or "invariant" it seems 
> reasonable to choose that or some variation of it as the word that means 
> the weaker form.

Even in the context that Walter is thinking, most of the time ROM is 
writable.  Think of BIOS ROM.  At some point, someone has to write it :)  I 
used to work with flash parts that were write once, and we considered those 
ROM chips. Which matches the meaning of const perfectly:  "I can't write it, 
but something else can".

I'm all for changing const to mean what invariant means, and using readonly 
or roview or rowhatever to mean what const means.

-Steve 





More information about the Digitalmars-d mailing list