Dylan question (OT, sorry)

This is a discussion on Dylan question (OT, sorry) within the lisp forums in Programming Languages category; Hi ! I'm posting this on comp.lang.lisp as well because my usenet provider doesn't have any news in comp.lang.dylan, so I suspect something is rotten in the state of Denmark... Consider this: define class <mymix> () end class <mymix>; define class <mysuper> (<mymix>) end class <mysuper>; define class <myclass> (<mymix>, <mysuper>) end class <myclass>; define method foobar (obj :: <mymix>) format-out("MyMix method.\n"); end method foobar; define method foobar (obj :: <mysuper>) format-out("MySuper method.\n"); end method foobar; define function main(name, arguments) let myobject = make (<myclass>); foobar (myobject); exit-application(0); end function main; If it were common lisp code, this wouldn't compile ...

Go Back   Application Development Forum > Programming Languages > lisp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-17-2008, 09:23 AM
Didier Verna
Guest
 
Default Dylan question (OT, sorry)


Hi !

I'm posting this on comp.lang.lisp as well because my usenet provider
doesn't have any news in comp.lang.dylan, so I suspect something is
rotten in the state of Denmark...

Consider this:

define class <mymix> ()
end class <mymix>;

define class <mysuper> (<mymix>)
end class <mysuper>;

define class <myclass> (<mymix>, <mysuper>)
end class <myclass>;

define method foobar (obj :: <mymix>)
format-out("MyMix method.\n");
end method foobar;

define method foobar (obj :: <mysuper>)
format-out("MySuper method.\n");
end method foobar;

define function main(name, arguments)
let myobject = make (<myclass>);
foobar (myobject);
exit-application(0);
end function main;


If it were common lisp code, this wouldn't compile because the class
precedence order can't be computed. Not surprising. Now, with opendylan
(1.0b4), this triggers a "serious warning" but compiles fine.

The foobar method actually called is the mymix one, which is puzzling to
me. But then, if I remove the method specialized on mymix, I get both a
serious warning and a run-time error stating that myobject is not of
class mysuper. This suggests that the compiler effectively removed
mysuper from the (multiple-)inheritance graph of myclass. ?!?!

Can somebody enlighten me ?

Thanks.

--
5th European Lisp Workshop at ECOOP 2008, July 7: http://elw.bknr.net/2008/

Didier Verna, didier@lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (0)1 53 14 59 22 didier@xemacs.org
Reply With Quote
  #2  
Old 06-17-2008, 10:51 AM
Ralf Mattes
Guest
 
Default Re: Dylan question (OT, sorry)

On Tue, 17 Jun 2008 15:23:33 +0200, Didier Verna wrote:

> Hi !
>
> I'm posting this on comp.lang.lisp as well because my usenet provider
> doesn't have any news in comp.lang.dylan, so I suspect something is
> rotten in the state of Denmark...
>
> Consider this:
>
> define class <mymix> ()
> end class <mymix>;
>
> define class <mysuper> (<mymix>)
> end class <mysuper>;
>
> define class <myclass> (<mymix>, <mysuper>)
> end class <myclass>;
>
> define method foobar (obj :: <mymix>)
> format-out("MyMix method.\n");
> end method foobar;
>
> define method foobar (obj :: <mysuper>)
> format-out("MySuper method.\n");
> end method foobar;
>
> define function main(name, arguments)
> let myobject = make (<myclass>);
> foobar (myobject);
> exit-application(0);
> end function main;
>
>
> If it were common lisp code, this wouldn't compile because the class
> precedence order can't be computed. Not surprising. Now, with opendylan
> (1.0b4), this triggers a "serious warning" but compiles fine.
>
> The foobar method actually called is the mymix one, which is puzzling to
> me. But then, if I remove the method specialized on mymix, I get both a
> serious warning and a run-time error stating that myobject is not of
> class mysuper. This suggests that the compiler effectively removed
> mysuper from the (multiple-)inheritance graph of myclass. ?!?!
>
> Can somebody enlighten me ?



Maybe: http://en.wikipedia.org/wiki/C3_linearization

or: http://192.220.96.201/dylan/linearization-oopsla96.html

This is referenced from:
http://www.cliki.net/C3%20superclass...rization%20MRO


HTH Ralf Mattes


> Thanks.
>

Reply With Quote
  #3  
Old 06-18-2008, 04:03 AM
Didier Verna
Guest
 
Default Re: Dylan question (OT, sorry)

Ralf Mattes <rm@mh-freiburg.de> wrote:

> Maybe: http://en.wikipedia.org/wiki/C3_linearization
>
> or: http://192.220.96.201/dylan/linearization-oopsla96.html
>
> This is referenced from:
> http://www.cliki.net/C3%20superclass...rization%20MRO


Thanks for the pointers !

--
5th European Lisp Workshop at ECOOP 2008, July 7: http://elw.bknr.net/2008/

Didier Verna, didier@lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (0)1 53 14 59 22 didier@xemacs.org
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:41 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.