JRS: In article <
[email protected]>
, dated Sun, 20 Nov 2005 08:30:00, seen in
Luke Matuszewski said:
( * so there is no programmical way to test if variable was defined but
not assigned a value explicitly... but i assume there is no need to )
var U // DO NOT ASSIGN TO U
var X
var Z1 = X==U
X = "something"
var Z2 = X==U
X = U
var Z3 = X==U
alert([Z1, Z2, Z3])
gives true,false,true so that one can very nearly tell.
Consider
function Inc(Parameter, maybeAnother) { var R, U
R = Parameter
if (maybeAnother != U) R += maybeAnother
return R }
(modelled on something in another language) which indicates a possible
use of testing for undefined.
The introduction of undefined as a keyword meaning undefined was a
great mistake, no doubt originated by a person with inadequate
experience of linguistics -- it makes discussion of the subject
unnecessarily difficult. Something like undef would have been
better, or unbestimmt or something neologistic such as wotzat .
There's something for saying that a language should not have reserved
words; instead, it should have reserved not-words - for example,
funkshun rather than function .
Implementations of Algol often used one of [ ' " ] as string quote and
the other as reserved word quote; and I recall one where "begin" was
written !begin but could be written as !beg. instead - any
special word could be so abbreviated to the minimum needed to be
differentiated from others. It made various forms of processing,
including discussion, easier. part of the software would expand any
such abbreviations.