Extended Type Design.
Bill Baxter
dnewsgroup at billbaxter.com
Wed Mar 21 12:52:18 PDT 2007
Don Clugston wrote:
> The natural association is "const" == "never changes, under any
> circumstances". "readonly" == "don't touch".
> Even for read-only memory, if you've ever used an EPROM burner, or
> flashed firmware, you know that someone can write to it. I've changed
> readonly memory, I've never changed a constant.
> The concept of 'read-only' access is pretty widely understood.
I dunno about that. Yes if you're talking about physical constants or
constants like Pi, they never ever change. But 'constant' is also used
frequently in mathematics to mean something that's simply "not variable
in the current context". Like when doing partial differentiation with
respect to y, all variables besides y are treated as constants.
And if you don't agree with me, the very first section of the Wikipedia
on "Constant" (http://en.wikipedia.org/wiki/Constant) talks about
"unspecified constants", referring to parts of an equation that simply
aren't variables. But you can definitely change them if you want (the
example they use is the Pythagorean theorem). They are only constant
for one particular instance of the problem. Even if the Wikipedia
article is way off base (the Pythagorean theorem seems a very odd choice
to demonstrate the concept of 'constant') the fact that such text
managed to make it onto Wikipedia indicates that the common
understanding of the word "constant" includes more territory than you're
apparently allowing for.
Also your definition of constant (i.e. something like Pi which
absolutely cannot change) seems to be a more a replacement for the
proposed 'final' as in 'final Pi = 3.14;' than for a reference whose
referent cannot change.
So personally I'm of the opinion we should pick two words that make at
least a modicum of sense in English, forget about what they might mean
in C++ or Java or whatever, make sure the common one is short, easy to
type, and easy on the eyes, and just go with it.
--bb
More information about the Digitalmars-d
mailing list