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

Re: [Q] Dylan to Java/JVM compiler?



Jason Trenouth <jason@harlequin.co.uk> writes:

> On Sat, 5 May 2001 17:15:02 -0400 (EDT), Lieven Marchand <mal@wyrd.be>
> wrote:
> 
> 
> > I wonder why they kept dispatching on instances. It's a feature I'd
> > remove from CLOS since it doesn't add much to the expressiveness of
> > the language and interferes with optimizing GF dispatch.
> 
> In Dylan it gets used for separating public abstract interface classes and
> private concrete implementation classes:
> 
> define method make ( class == <interface>, #key, #rest initargs )
>   apply( make, <implementation>, initargs);
> end method;

Nice example. 

But what's the use of an abstract interface if only one implementation
can exist? Suppose I want <my-implementation> to also implement
<interface>. Do I write a make-my-implementation?

<off-topic> 
BTW, why does LispWorks complain about the equivalent CL code? The
Hyperspec specifically allows users to augment the MAKE-INSTANCE
generic function.

CL-USER 8 > (defmethod make-instance ((class (eql (find-class 'abstract))) &rest args)
              (apply #'make-instance 'concrete args))

Error: Defining method #<STANDARD-METHOD MAKE-INSTANCE NIL ((EQL #<STANDARD-CLASS ABSTRACT 21151714>)) 204D8444> visible from packages COMMON-LISP.
  1 (continue) Define it anyway.
  2 Discard the new method.
  3 (abort) Return to level 0.
  4 Return to top loop level 0.

It works as expected when you choose restart 1.
</off-topic>

-- 
Lieven Marchand <mal@wyrd.be>
Glaðr ok reifr skyli gumna hverr, unz sinn bíðr bana.



Follow-Ups: References: