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

Re: Can one do the following in dylan?



At 3:25 PM -0700 3/27/01, Scott Ribe wrote:
>For example, given a base class of <plug-in>, any number of plug in
>classes could be created and compiled into dynamically loaded libraries,
>possibly each one being implemented by filling out the skeleton code
>provided with <sample-plug-in>.
>
>Could you create a class at runtime, descended from <plug-in>? How would
>you get generic functions on <plug-in> to dispatch to the subclasses?
>
>I think there are two problems: getting the subclasses created, and
>mapped into method dispatch?

First, forgive me if I don't remember everything properly, since I 
haven't touched Dylan in nearly 3 years.

The language allows for not only creating classes at runtime, but 
also generic functions (so you could *really* do anonymous things), 
with make(<class> ...) and make(<generic-function> ...).  I don't 
think the language specified the initargs for these, but it was my 
intent that they should be usable in this fashion.  They probably 
worked in Harlequin's Dylan.

In the evaluation of a method construct (as in other places), the 
type specifiers are considered to be evaluated expressions, although 
that is probably understood by few if any compilers.  So you would do 
something like evaluate
    method(x :: type1, y :: type2) ... end
where 'type1' and 'type2' are local variables or computed or whatever.

Anyway, that was the (or at least my) intent.
-- 
---------------------------------------------------------------------------
Glenn S. Burke           | gsb@pobox.com
Phone: 781/275-8556      | Alternate: gsb@mc.lcs.mit.edu
Fax:   888/848-2369      | Backup: gsb@tiac.net


References: