[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jul 5 21:11:05 1994 
Subject:Re: Name Space Pollution 
From: Robin Popplestone  
Volume-ID:940706.03 

The reason for  having slot-access  be performed  by function-call  is
simply that it  is fully abstract.  When a C,  Pascal, Ada  programmer
writes

   Obj.x

the representation of  Obj  becomes very strongly constrained,
namely that getting the value of -x- is to be done by memory
access. Thus decisions about representation get bound into code.
In POP-11, of course,  Obj.x is simply a synonym for the function
application  x(Obj). So there is no decision about representation.
Properties incidentally give a very nice decoupling - slots in
data-structures are the usual way of defining functions on objects
which are in some sense arbitrary, so that there is no algorithm for
computing the value. But a POP-11 property can be used to create
such a function without having to modify the data type definition at
all.

Of course name-spaces can get polluted doing this. But the answer
to name space pollution is a proper and disciplined structuring
of ones function name space. It has to be confessed that POP-11
has got out of hand in this respect, despite the existence of
adequate mechanisms for controlling it (all you really need in
a non-statically typed language is closures).

The SML community have worked rather hard at trying to structure
name-space to avoid large-scale pollution. I recommend looking
at what they have done, even though some aspects of SML are actually
inimical to abstraction (particularly the constructor-based patterns).

Robin.