ALU capability (was Re: [E-Lang] Authority -- what is its dual?)
Peter Van Roy
pvr@info.ucl.ac.be
Fri, 19 Oct 2001 11:56:09 +0200
> >As I remember it, Smalltalk has lexically-scoped closures, "blocks", which
> >are used to define control abstractions. Blocks are not objects, which is
> >exactly as it should be, IMHO.
>
> Smalltalk Blocks are Objects. They respond to the 'value' message by
> computing their value. they respond to other messages, and Smalltalk
> programmers can extend their behavior (which is how exception handling was
> implemented, for instance).
This is just veneer. A lexically-scoped closure is a very different beast
from a standard class-defined object -- it requires specific mechanisms in
the virtual machine to implement it. If you want the phrase 'Blocks are
Objects' to mean something, then you must define precisely what you mean
by 'Object'!
> >1. Everything has uniform object syntax --> bad idea! It just pushes the
> > language's richness into the class & object names, an extra layer of
> > syntax that is cumbersome.
>
> The choice of syntax has almost nothing to do with whether "everything is
> an object". Bad syntax is bad syntax, and is a different level of issue, I
> think.
That is one viewpoint, which I happen to share. The 'great mass of
object-oriented programmers' may have another view on the matter.
They tend to confuse syntax and semantics. Even researchers do so. How
many papers I read that give C++-like or Java-like *syntax* which is
supposed to pass as semantics? This sloppiness is widespread and we have
to be conscious of that.
> >(Another issue is whether all ADTs should be potentially definable with
> >inheritance. That's another can of worms!)
>
> Inheritance is mostly independent of object-ness--it isprimarily a
> code-sharing hack :-)
You know that and I know it, but the great mass of object-oriented
programmers do not. It is a widespread view that object-ness requires
inheritance. Object-oriented programming is just a style of higher-order
functional programming with explicit state, except that OOP has syntactic
support for extending definitions, i.e., inheritance. So the confusion
has some justification!
Peter