Guile Mailing List Archive

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

Re: tiny-clos-questions

At 02:18 AM 11/8/98 -0800, Craig Brozefsky wrote:
>This is pretty much what I just did in the last couple hours (as well
>as make a most kick ass curry).  After seeing this message from you I
>figured I should just code up some of the ideas I had.  I now have
>CLOS like macros for defining classes and methods, and have extended
>the stock meta-objects to support some niceties like documentation and
>default initialization arguments.  I don't yet have key and optional
>args to generic functions but I should be able to get those rolled in
>the next night or so.

Currying functions and cooking curry sounds like Scheme hacking at its best.

>They are not quite CLOS copies, since I want to avoid alot of the
>complexities, and design by commitee features of CLOS.  So I'm prolly
>not going to be building method combination abstractions, and more
>complex method selection, but I do want to get optional and keys in
>the lambda lists of methods, and better debugging.  Also should be
>able to copy alot of the utility defines and neato redirection stuff
>in the standard-class (slot-missing and the like).

I'd recommend a minimal number of features.  Declarative method combination
is a cool thing, but a lot of work.  Tiny uses (call-next-method) and that
is OK to start with.  This (or worse) is what every other languages uses.

Also having slot-unbound be a generic function that is involved with
slot-value can make delivering performance complicated.  For example, in
Allegro Common Lisp, (slot-value object 'slot-name) in a method, is
compiled into a 
four argument call, something like (%slot-value slots offset object slot-name)
The last 2 arguments are only used when a slot is unbound, but they effect
the overhead of every slot reference.  I'd be happy with the value of an
unbound slot being '() or #f or #unspecified.

For keywords, i wouldn't use any special syntax, unless compatibility with
another language, like stk is important.  In common lisp, the old style was
to use :fern for the keyword "fern" but now i just use 'fern.  In terms of
a module system, the keyword "fern" is as much a part of the interface as a
function "fern", so they should be treated the same way.

>I want to retain the simplicity and clean semantics of tiny-clos
>regardless.  But I'll still be raiding PCL 8^)

PCL is worth raiding and worth reading.

>> STK is a great example of the power of tiny clos.  TK objects have a
>> different metaclass, but look just like other STK objects.  Extending this
>> idea for guile, i could imagine a MOP that unified things like foreign
>> function interface, and remote method invocation.

Guile Home | Main Index | Thread Index