This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,13 @@
coclass 'delegator'
operation=:3 :'thing__delegate ::thing y'
thing=: 'default implementation'"_
setDelegate=:3 :'delegate=:y' NB. result is the reference to our new delegate
delegate=:<'delegator'
coclass 'delegatee1'
coclass 'delegatee2'
thing=: 'delegate implementation'"_
NB. set context in case this script was used interactively, instead of being loaded
cocurrent 'base'

View file

@ -0,0 +1,15 @@
obj=:conew'delegator'
operation__obj''
default implementation
setDelegate__obj conew'delegatee1'
┌─┐
│4│
└─┘
operation__obj''
default implementation
setDelegate__obj conew'delegatee2'
┌─┐
│5│
└─┘
operation__obj''
delegate implementation