- GHClassGhost able to replace class of real objects. It implements cannotInterpret: trick to intercept all instance messages. Subclasses should define two behaviours: #ghostBehaviour (as any other ghost) and #instancesBehaviour which will process instance messages. In previous version it was different message to same #ghostBehaviour.
GHObjectGhost>>doesNotUnderstand: aMessage
self ghostBehaviour intercept: aMessage to: self
GHInstanceMessagesInterceptor>>cannotInterpret: aMessage
"some logic to find ghostClass"
ghostClass instancesBehaviour intercept: aMessage to: self
- New kind of proxies:
- GHObjectVirus. It is special kind of GHClassProxy. It infects real object to intercept it messages. From meta level infected object looks like healthy object which means that meta messages are executed by infected object itself. As class virus looks like real victim class. So in case when virus is created with standard meta level tools will not differ him from health object. There are special messages which allow ask object about viruses:
- infectedObject isInfectedByVirus
- infectedObject virus
- infectedObject recoverFromVirus
Sorry I did not get this one.
rect := 0@0 corner: 2@3rect stub area willReturn: 1000.rect area "=> 1000".rect origin "=> 0@0".
rect isInfectedByVirus "=> true"
rect recoverFromVirus. "or virus heal: infectedObject"rect isInfectedByVirus "=> false"
Free forum by Nabble | Edit this page |