In article <536decca$0$29980$c3e8da3$>,
>Personally, I don't imagine that there ever could be a language where
>variables were first class values *exactly* the same as ints, strings,
>floats etc. Otherwise, how could you tell the difference between a
>function which operated on the variable itself, and one which operated on
>the value contained by the value? The best you can do is for variables to
>be "second class" -- you can do these things to them, but you need
>special syntax or declarations to tell the compiler you're operating on
>the variable rather than the variable's value. E.g. Pascal and Algol have
>syntax for instructing the compiler when to pass a variable as a value,
>and when to pass the value. C gives you nothing.

You're talking about Algol, but there is a great distinction between
Algol60 and Algol68. Algol68 through the ref keyword goes a long
way towards making variables first class citizens.
E.g. although `` int i'' in Algol68 means practically the same as in
C, it is defined as being an abbreviation of
'ref' 'int' i = 'loc' 'int';

This means so much that i is a reference to an otherwise unnamed int
that is allocated locally. Furthermore you can't break the tie between
i and that int (because you use =, you could have used := )
Because I refers to that location you can change it by
Note that the left side *must* be a reference. You can't change an
int, you can only change the content of a memory place you can refer

Now you can define
'ref' 'int' pi;
pi := i;

van Wijngaarden and crue pretty much nailed it, IMO.


>Steven D'Aprano

Groetjes Albert
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar& &=n


Reply via email to