Simen kjaeraas:
> That's because 'val' says absolutely nothing about the variable's
> constancy. Immutable may be a mouthful, but at least it conveys some
> useful information even for those who have not read the manual.

Identifiers and keywords like "$", "int" and "bool" are not words, yet they are 
used instead of "length", "integer" and "boolean" (boolean is used in Java). So 
in the end it's a matter of compromises between readability and length 
(according to Zipf law too) (and convention too, "bool" is used by many 
languages, so it's not hard to know what it is for). If something is used quite 
often, then even an abbreviation can be acceptable (this was especially true 
for languages like C designed before the current age of IDEs).

"val" is not an English word  and it means nothing, but it's an abbreviation of 
"value" that is a word and from a mathematical point of view you can see it as 
an immutable, as opposed to variable (named "var" in Scala).

I have proposed "val" because it's short, it has a precedent in Scala and 
mathematics, it's easy to write (unlike "length"), and because I've seen in my 
functions I now often annotate values with "immutable".

Bye,
bearophile

Reply via email to