Tue, 18 Feb 2003 00:29:50 +0900, Chris Pine <nemo / hellotree.com> pisze:

> Yes... perhaps the confusion is my fault.  I guess I should not
> have said `variables'... I meant `bindings'.
> 
> Though, in thinking about this more, I think that good 'ol C has
> this; they're called pointers.

Ok, let me summarize. There are two approaches to bindings and variables:

1. Immutable bindings, with mutable variables as separate first-class
   objects. This is usually the case in functional languages.

2. Mutable bindings. This is more common.

Mutable bindings can be first-class in two ways: either the environment
of a scope (function, block etc.) is wrapped in an object which maps
local variable names to their current values, or individual variables
are objects which can be passed around. Or both.

For immutable bindings only the case of the whole environment is
interesting, because the immutable variable itself is equivalent to
its value.

Personally I don't see the necessity of first-class environments.
Local variables are temporary and if you want to define many of them
in a loop, perhaps it's better to put these objects in a dictionary
or array. It also makes optimization harder.


C, C++, Pascal and Perl are different than almost all other languages
in that their variables *contain* values instead of *referring*
to values existing elsewhere (in C, C++ and Pascal this model is the
only one possible because of lack of GC). In this model it's necessary
to introduce pointers (sometimes called references), so you can also
refer to values stored in variables instead of making copies, or create
values which are not stored in variables.

In other languages you don't need pointers to refer to objects,
so most languages omit them altogether.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak / knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/