MareaHeaderGrey

Abstract

Ghost is an uniform, light-weight and stratified general purpose Proxy model. Currently there is an implementation in Pharo Smalltalk. This toolbox provides low memory consuming proxies for regular objects as well as for classes and methods. In addition, Ghost supports not only proxies for classes or methods, but proxies as classes and as methods. This means that it is not only possible to create a proxy for a class or a method but also that such proxy takes the place of the target object without crashing the system and still intercepting the messages. If a proxy takes the place of a class it intercepts both, messages received by the class and lookup of methods for messages received by instances. Similarity, if a proxy takes the place of a method, then the method execution is intercepted too.Ghost proxies let us intercept all messages sent to a proxy, with clear separation between the layers of intercepting and handling interceptions.

Publications

Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, St├ęphane Ducasse, and Luc Fabresse. "Efficient Proxies in Smalltalk". In Proceedings of ESUG International Workshop on Smalltalk Technologies (IWST 2011), Edinburgh, Scotland, 2011. PDF.

Presentations

We presented Ghost proxies in IWST. The slides of the presentation can be found here and in slideshare. In addition, the presentation was recorded and here is the video.

Interesting Links

Installation

Take a Pharo image an evaluate:
Gofer new
	squeaksource: 'Marea';
	package: 'GhostProxies';
	package: 'GhostProxiesTests';
load.

Getting Started

The easiest way to getting started with GhostProxies is by taking a look to its tests in the package 'GhostProxiesTests'. Here is one example:
testSimpleForwardingForRegularObject
	| proxy |
	proxy := ObjectProxy proxyFor: (Point x: 3 y: 4). 
	self assert: proxy x equals: 3. 
	self assert: proxy y equals: 4.
And here is another one:
testSimpleForwardingForMethod
       | aProxy aUser method |
       aUser := User named: 'Kurt'.
       method := User methodDict at: #username.
       [aProxy := ObjectProxy createProxyAndReplace: method. 
       self assert: aProxy getSource equals: 'username ^ username'. 
       self assert: aUser username equals: 'Kurt'.
	 ] ensure: [ aProxy uninstall ]

Abstract

Ghost is an uniform, light-weight and stratified general purpose Proxy model. Currently there is an implementation in Pharo Smalltalk.

This toolbox provides low memory consuming proxies for regular objects as well as for classes and methods. In addition, Ghost supports not only proxies for classes or methods, but proxies as classes and as methods. This means that it is not only possible to create a proxy for a class or a method but also that such proxy takes the place of the target object without crashing the system and still intercepting the messages. If a proxy takes the place of a class it intercepts both, messages received by the class and lookup of methods for messages received by instances. Similarity, if a proxy takes the place of a method, then the method execution is intercepted too.

Ghost proxies let us intercept all messages sent to a proxy, with clear separation between the layers of intercepting and handling interceptions.

Publications

Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, St├ęphane Ducasse, and Luc Fabresse. "Efficient Proxies in Smalltalk". In Proceedings of ESUG International Workshop on Smalltalk Technologies (IWST 2011), Edinburgh, Scotland, 2011. PDF.

Presentations

We presented Ghost proxies in IWST. The slides of the presentation can be found here and in slideshare. In addition, the presentation was recorded and here is the video.

Interesting Links

  • For more details there is a paper in progress...

Installation

Take a Pharo image an evaluate:

Gofer new
	squeaksource: 'Marea';
	package: 'GhostProxies';
	package: 'GhostProxiesTests';
load.

Getting Started

The easiest way to getting started with GhostProxies is by taking a look to its tests in the package 'GhostProxiesTests'. Here is one example:

testSimpleForwardingForRegularObject
	| proxy |
	proxy := ObjectProxy proxyFor: (Point x: 3 y: 4). 
	self assert: proxy x equals: 3. 
	self assert: proxy y equals: 4.

And here is another one:

testSimpleForwardingForMethod
       | aProxy aUser method |
       aUser := User named: 'Kurt'.
       method := User methodDict at: #username.
       [aProxy := ObjectProxy createProxyAndReplace: method. 
       self assert: aProxy getSource equals: 'username ^ username'. 
       self assert: aUser username equals: 'Kurt'.
	 ] ensure: [ aProxy uninstall ]