[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: s-exprs + prototypes

On Sunday, June 22, 2003, at 01:30  AM, Michael Vanier wrote:

James McCartney wrote:

>> Functions are objects and objects are functions. What is the 
>> difference?

Michael Vanier replied:

> The big difference is that functions have no notion of inheritance, 
> whereas
> objects generally do.  There are many different ways of handling this, 
> none
> of which are manifestly the "best" way.  So the supposed generality of
> objects is IMO an illusion.  That's not to say objects aren't useful, 
> but I
> think object systems should be in libraries rather than built-in.
> If you are advocating objects without inheritance, then your claim is
> accurate.  But who wants that?

Equating inheritance with objects is a red herring, IMO. It's just a 
detail of how popular object systems have typically been implemented. 
In dynamically typed OO languages, it's a way to organize code reuse. 
In statically typed languages it doubles as a type hierarchy.

Classes and prototypes are just different styles of OO, in much the 
same way that CLOS is a "style" of LISP. With appropriate libraries, 
you can do class-based OO in prototype languages and vice-versa.

The essence of objects is encapsulation.

It seems to me that the central difference between OO languages and 
Lispy languages is that in OO you want to put state and behaviour 
behind the same abstraction, but in Lispy languages you want to keep it