Talk:Respond to an unknown method call: Difference between revisions
Content added Content deleted
(ok) |
|||
Line 40: | Line 40: | ||
:::: the difference is that <code>(no-applicable-method>)</code> and <code>(send*)</code> can be part of your library, while a user of the library only needs to do <code>(send* 'message1> Obj)</code>. this would be even more flexible than the common lisp solution where at least a generic function needs to exist before <code>(no-applicable-method)</code> can be called. but the generic function doesn't do much more than what <code>(send*)</code> would do in this example.--[[User:EMBee|eMBee]] 13:15, 7 November 2011 (UTC) |
:::: the difference is that <code>(no-applicable-method>)</code> and <code>(send*)</code> can be part of your library, while a user of the library only needs to do <code>(send* 'message1> Obj)</code>. this would be even more flexible than the common lisp solution where at least a generic function needs to exist before <code>(no-applicable-method)</code> can be called. but the generic function doesn't do much more than what <code>(send*)</code> would do in this example.--[[User:EMBee|eMBee]] 13:15, 7 November 2011 (UTC) |
||
::::: Hmm, OK, though I'm not convinced. The task description doesn't say it this way. So I'll redefine 'send'. --[[User:Abu|Abu]] 14:01, 7 November 2011 (UTC) |
::::: Hmm, OK, though I'm not convinced. The task description doesn't say it this way. So I'll redefine 'send'. --[[User:Abu|Abu]] 14:01, 7 November 2011 (UTC) |
||
:::::: well, maybe i am missinterpreting the task, we'd have to ask the creator. |
|||
:::::: i looked at the picoLisp docs and found that in difference to eg common lisps CLOS picoLisp classes actually do have member functions. now i am wondering, in your solution you define (no-applicable-method>) as a regular function and not as a class method. couldn't you also do this? |
|||
<lang lisp>(class +B) |
|||
(dm no-applicable-method> (Msg) |
|||
(pack "No method for " Msg " on " This) )</lang> |
|||
:::::: this would provide the ability to only have specific classes respond to unknown method calls, or have different classes give different responses.--[[User:EMBee|eMBee]] 17:16, 7 November 2011 (UTC) |