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

Re: s-exprs + prototypes

Steve Dekorte wrote:
> On Wednesday, June 25, 2003, at 10:52 AM, Pascal Costanza wrote:
>> The Lisp paradigm is rooted in the belief that there is no single 
>> right perception of reality. Instead, a language has to provide the 
>> building blocks that allow you to reconstruct any perception of the 
>> world.
> What I'm saying is that an object = functions & data in a context/scope. 
> If LISP has functions and data in a context, it has objects. The only 
> difference (AFAICS) is which scoping rules you choose.

Maybe, but what's more important is the mental model of the programmer. 
If you don't use the language in an "object-oriented way" you are not 
doing OOP.

>> So what you are discussing is the question whether a single-paradigm 
>> approach is preferable over a multi-paradigm approach, or vice versa. 
>> These two views cannot be reconciled by definition. The proponent of a 
>> single-paradigm approach thinks that he/she has found the right model 
>> for any description of the real world whereas the multi-paradigm 
>> proponent thinks that things can be so vastly different from instance 
>> to instance that no single paradigm can ever be suitable to each and 
>> every description of the world. [1]
> Lisp's choice of scoping rules defines it's "paradigm". It's not clear 
> to me how it's any more "multi-paradigm".

(send object message . parameters) uses a single dispatch object model.

(f x y) uses a functional model

(print-object x y) uses a multi dispatch object model with generic functions

(define-rule (x y z) ...) uses a logical paradigm

(define-constraint ...) uses a constraint-based approach

and so forth.

Macros allow you to give precise meanings to all these constructs. Yes, 
you need to map these constructs to the mixed imperative/functional 
paradigm of "core Lisp", but above such a macro layer you can 
effectively make use of the paradigm that is conveyed by these macros.

One of the arguments in this thread was (if I understand it correctly) 
that once you have defined a function with defun then you are stuck to 
the restrictions imposed by defun - namely that you don't get certain 
kinds of polymorphism that OO languages usually provide. The answer to 
this from a multi-paradigm perspective is: don't use defun then. Use 
defgeneric / defmethod if you want to program in an OO style.


Pascal Costanza               University of Bonn
mailto:costanza@web.de        Institute of Computer Science III
http://www.pascalcostanza.de  Römerstr. 164, D-53117 Bonn (Germany)