Issue 3648 in pharo: A "Stratified" proxy in smalltalk

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo
Status: Started
Owner: [hidden email]
Labels: Type-RequestForEnhancement

New issue 3648 by [hidden email]: A "Stratified" proxy in smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648


This is an implementation of A "Stratified" proxy in smalltalk.

Note:
The category/package name should be changed before integrating into image.

Attachments:
        StratifiedProxy.st  5.5 KB
        StratifiedProxy-Tests.st  719 bytes


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo
Updates:
        Status: Fixed

Comment #1 on issue 3648 by [hidden email]: A "Stratified" proxy in  
smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

I want that!
:)
Stef


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo

Comment #2 on issue 3648 by [hidden email]: A "Stratified" proxy in  
smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

keep in mind that this code is for review. not for immediate integration.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo

Comment #3 on issue 3648 by marianopeck: A "Stratified" proxy in smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

Hi Igor. I remember you showed me this implementation once I was asking  
about how to do proxies for classes. It works, but there is something I  
don't like: having to do the shallow copy of the class.

createHandler
        " This method will create a handler - an anonymous class, which will  
receive the
        #handleMessage:forProxy: message.
        To get a proxy object, you must instantiate a handler instance by sending  
#basicNew to it.
        See my subclasses for examples "
        ^ self shallowCopy
                methodDict: nil;
                superclass: self


I don't like that because for EACH proxy, I have to instantiate a new class  
(an object with a lot of intsVars) and an instance of that class.

In my case, I want to create a lot of proxies and the memory is important,  
so that solution doesn't scale. What we did is to use the same proxy as the  
metaclass. So we defined for example:

ProtoObject subclass: #ClassProxy
        instanceVariableNames: 'superclass methodDict format fileName'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Proxies'


ClassProxy >> initialize
        super initialize.
        superclass := ProxySuperclass.
        methodDict := nil.
        fileName := nil.

ProxySuperclass >> cannotInterpret: aMessage
        ^  ClassProxyHandler mareaHandleCannotInterpret: aMessage for: aMessage  
lookupClass receiver: self
       
       
Anyway, if you are interested, take a look to the package Proxies in  
http://www.squeaksource.com/Marea



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo

Comment #4 on issue 3648 by [hidden email]: A "Stratified" proxy in  
smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

Yes, of course it could be more optimal. Here is updated version.




Attachments:
        StratifiedProxy.st  5.5 KB


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo
Updates:
        Labels: Milestone-1.3

Comment #5 on issue 3648 by [hidden email]: A "Stratified" proxy in  
smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3648 in pharo: A "Stratified" proxy in smalltalk

pharo
Updates:
        Status: Closed

Comment #6 on issue 3648 by [hidden email]: A "Stratified" proxy in  
smalltalk
http://code.google.com/p/pharo/issues/detail?id=3648

in 13068