new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 deletions
30
Task/Delegates/PicoLisp/delegates.l
Normal file
30
Task/Delegates/PicoLisp/delegates.l
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
(class +Delegator)
|
||||
# delegate
|
||||
|
||||
(dm operation> ()
|
||||
(if (: delegate)
|
||||
(thing> @)
|
||||
"default implementation" ) )
|
||||
|
||||
|
||||
(class +Delegate)
|
||||
# thing
|
||||
|
||||
(dm T (Msg)
|
||||
(=: thing Msg) )
|
||||
|
||||
(dm thing> ()
|
||||
(: thing) )
|
||||
|
||||
|
||||
(let A (new '(+Delegator))
|
||||
# Without a delegate
|
||||
(println (operation> A))
|
||||
|
||||
# With delegate that does not implement 'thing>'
|
||||
(put A 'delegate (new '(+Delegate)))
|
||||
(println (operation> A))
|
||||
|
||||
# With delegate that implements 'thing>'
|
||||
(put A 'delegate (new '(+Delegate) "delegate implementation"))
|
||||
(println (operation> A)) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue