[Prev][Next][Index][Thread]
Re: Multidispatch semantic
I think that FunDev doesn't actually signal such an error, but if you
run the program under the debugger, you will see that there are
warnings that indicate the ambiguity.
I don't know why we did this, but I think it had to do with a bunch
of CLOS legacy code that we didn't have time to rewrite.
Samuele Pedroni wrote in message <3b4fa00c@pfaff.ethz.ch>...
>Hi. I have tried the following program. After reading the DRM 6. Functions-
>Method Dispatch I would have expected
>some kind of ambiguity error, the results that I get with FunDev are just
>like CLOS multidispatch. Argument order counts.
>What I'm missing? Thanks Samuele Pedroni.
>
>Module: hello2
>
>define class <panel> (<object>)
>end class <panel> ;
>
>define class <pad-panel> (<panel>)
>end class <pad-panel> ;
>
>define class <specific> (<object>)
>end class <specific> ;
>
>define method present (panel :: <panel> , obj :: <object>)
>format-out("generic panel present");
>end method present;
>
>define method present (panel :: <pad-panel>, obj :: <object> )
>format-out("pad present");
>end method present;
>
>define method present (panel :: <panel> , obj :: <specific> )
>format-out("generic panel <specific> present");
>end method present;
>
>define method present2 (obj :: <object> , panel :: <panel> )
>format-out("generic panel present(2)");
>end method present2;
>
>define method present2 (obj :: <object> , panel :: <pad-panel> )
>format-out("pad present(2)");
>end method present2;
>
>define method present2 (obj :: <specific> , panel :: <panel> )
>format-out("generic panel <specific> present(2)");
>end method present2;
>
>define method main () => ()
> let pad = make(<pad-panel>);
> let obj = make(<specific>);
> present(pad,obj) ;
> format-out("\n");
> present2(obj,pad) ;
>end method main;
>
>/* Output:
> pad present
> generic panel <specific> present(2)
>
>given the rules in DRM 6. Functions - Method Dispatch
>I would have expected an ambiguity error in both cases.
>*/
>
>begin
> main();
>end;
>
>
References: