[Prev][Next][Index][Thread]
Re: [Q] Dylan to Java/JVM compiler?
Lieven Marchand wrote:
....
> <off-topic>
> BTW, why does LispWorks complain about the equivalent CL code? The
> Hyperspec specifically allows users to augment the MAKE-INSTANCE
> generic function.
The Hyperspec allows users to define CAR and CDR.
That doesn't mean a prudent implementation might not warn
you or ask for confirmation before carrying that out. ;-)
The difference in semantics between Dylan and CLOS in this context
is that in Dylan no default method is added to "make" for abstract
classes. So the example's definition is not a "redefinition".
Whereas in CLOS there isn't really an "abstract" adjective. So
in the CLOS case you are redefining the "object creator" for a
class. Once gone, it is gone for good (unless you took earlier
measures the garbage collector may reclaim it).
> CL-USER 8 > (defmethod make-instance ((class (eql (find-class 'abstract))) &rest args)
> (apply #'make-instance 'concrete args))
>
If you issue this a second time do you get the same "Error"?
[ sorry I don't have access to Lispworks at the moment. ]
In Dylan it is safe to add methods to "make" for abstract classes.
However, if you add methods to "make" for concrete classes you're
playing with fire. I could picture a prudent Dylan implementation
issuing a warning about doing that... if it bothered to check.
Lyman
Follow-Ups:
References: