Const system names
bearophile
bearophileHUGS at lycos.com
Tue Feb 16 09:34:15 PST 2010
Lars T. Kyllingstad:
>I don't agree that immutable should be the the default. The default should be the most common case, which is mutable.<
Is it true that mutables are the most common?
Is it true that mutables will be the most common in D programs written few years from now? You must design a language for tomorrow, not for yesterday.
Typing var " in the code is not that costly. While writing "immutable " often in the code is a lot of typing.
Scala e Clojure like immutables, they are good for multicores :-)
I've done a small search of the "val" and "var" attributes in Scala language:
val (immutables):
http://www.google.com/codesearch?q=%22val%22+lang%3Ascala
29_300
var (variables):
http://www.google.com/codesearch?q=%22var%22+lang%3Ascala
15_200
It's not a scientific search, but shows that immutables are not that uncommon in Scala.
> const: manifest constants, no storage (like const in D1, enum in D2)
> readonly: a read-only view of mutable data (like const in D2)
> immutable: immutable data (like now)
"const" and "readonly" are synonims, so I don't like those names, I prefer names that mean something different (related to their different semantics). (I agree that "valview" is not nice looking).
Bye,
bearophile
More information about the Digitalmars-d
mailing list