Respond to an unknown method call: Difference between revisions

Content added Content deleted
(Ommit Scala)
(Added Oz solution)
Line 119: Line 119:
<lang ocaml>Error: This expression has type example
<lang ocaml>Error: This expression has type example
It has no method ding</lang>
It has no method ding</lang>

=={{header|Oz}}==
<lang oz>declare

class Example
meth init skip end
meth foo {System.showInfo foo} end

meth bar {System.showInfo bar} end

meth otherwise(Msg)
{System.showInfo "Unknown method "#{Label Msg}}
if {Width Msg} > 0 then
{System.printInfo "Arguments: "}
{System.show {Record.toListInd Msg}}
end
end
end

Object = {New Example init}

in

{Object foo}
{Object bar}
{Object grill}
{Object ding(dong)}</lang>


=={{header|Perl}}==
=={{header|Perl}}==