Respond to an unknown method call: Difference between revisions

Content added Content deleted
(→‎{{header|Lasso}}: Adding Lasso unknown method handler)
m (→‎{{header|Lasso}}: clean up some formatting)
Line 425: Line 425:
public _unknownTag(...) => {
public _unknownTag(...) => {
local(n = method_name->asString)
local(n = method_name->asString)
return 'tried to handle unknown method called "'+#n+'"'+(#rest->size ? ' with args: "'+#rest->join(',')+'"')+'\r'
return 'tried to handle unknown method called "'+#n+'"'+
(#rest->size ? ' with args: "'+#rest->join(',')+'"')+'\r'
}
}
}
}
Line 431: Line 432:
local(e = exampletype)
local(e = exampletype)
#e->foo() // outputs 'this is foo'
#e->foo()
#e->bar() // outputs 'this is bar'
// outputs 'this is foo'

#e->stuff() // outputs 'tried to handle unknown method called "stuff"'
#e->bar()
#e->dothis('here',12,'there','nowhere') // outputs 'tried to handle unknown method called "dothis" with args: "here,12,there,nowhere"'</lang>
// outputs 'this is bar'

#e->stuff()
// outputs 'tried to handle unknown method called "stuff"'

#e->dothis('here',12,'there','nowhere')
// outputs 'tried to handle unknown method called "dothis" with args: "here,12,there,nowhere"'</lang>


=={{header|Logtalk}}==
=={{header|Logtalk}}==