Const system names

retard re at tard.com.invalid
Tue Feb 16 09:45:06 PST 2010


Tue, 16 Feb 2010 12:34:15 -0500, bearophile wrote:

> 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.

Note that also function parameters are val in scala unlike in java or d. 
>From my experiences with various kinds of (functional) languages with 
first class functional features, const values become the common case. 
Why? Because everything can return a value, you don't need uninitialized 
references.



More information about the Digitalmars-d mailing list