problem with slots on proxies

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

problem with slots on proxies

Tudor Girba-2
Hi,

I am trying to play with some proxies that inherit from ProtoObject have slots. For example, I try to do this, but I get an error:

ProtoObject subclass: #BBB
        instanceVariableNames: 'variable'
        classVariableNames: ''
        package: 'BBB'.
BBB class allSlots first read: BBB new

The problem is that the slot sends messages to its parent object, such as:
IndexedSlot>>read: anObject
        ^ anObject instVarAt: index

This is a problem because a similar scenario happens also when you open a debugger on a proxy that tries to communicate with a remote image.

I think that instead of sending messages to the receiver, we should make the slot work with the mirror primitives.

For example, we would rewrite the read: method like:
IndexedSlot>>read: anObject
        ^ thisContext object: anObject instVarAt: index

Do you agree? Can I open an issue for this? I think this is important.

Cheers,
Doru


--
www.tudorgirba.com
www.feenk.com

"If you can't say why something is relevant,
it probably isn't."


Reply | Threaded
Open this post in threaded view
|

Re: problem with slots on proxies

Denis Kudriashov
Hi

2016-03-26 21:54 GMT+01:00 Tudor Girba <[hidden email]>:
Hi,

I am trying to play with some proxies that inherit from ProtoObject have slots. For example, I try to do this, but I get an error:

ProtoObject subclass: #BBB
        instanceVariableNames: 'variable'
        classVariableNames: ''
        package: 'BBB'.
BBB class allSlots first read: BBB new

The problem is that the slot sends messages to its parent object, such as:
IndexedSlot>>read: anObject
        ^ anObject instVarAt: index

This is a problem because a similar scenario happens also when you open a debugger on a proxy that tries to communicate with a remote image.

I think that instead of sending messages to the receiver, we should make the slot work with the mirror primitives.

For example, we would rewrite the read: method like:
IndexedSlot>>read: anObject
        ^ thisContext object: anObject instVarAt: index

Do you agree? Can I open an issue for this? I think this is important.

Yes, please.
But does not thisContext degrades performance?   
Guille extracted mirror primitives to separate class MirrorPrimitives (project Mirror in Pharo repo). I think we should start to use it and move away from context.
Reply | Threaded
Open this post in threaded view
|

Re: problem with slots on proxies

Tudor Girba-2
Hi,


> On Mar 27, 2016, at 6:47 PM, Denis Kudriashov <[hidden email]> wrote:
>
> Hi
>
> 2016-03-26 21:54 GMT+01:00 Tudor Girba <[hidden email]>:
> Hi,
>
> I am trying to play with some proxies that inherit from ProtoObject have slots. For example, I try to do this, but I get an error:
>
> ProtoObject subclass: #BBB
>         instanceVariableNames: 'variable'
>         classVariableNames: ''
>         package: 'BBB'.
> BBB class allSlots first read: BBB new
>
> The problem is that the slot sends messages to its parent object, such as:
> IndexedSlot>>read: anObject
>         ^ anObject instVarAt: index
>
> This is a problem because a similar scenario happens also when you open a debugger on a proxy that tries to communicate with a remote image.
>
> I think that instead of sending messages to the receiver, we should make the slot work with the mirror primitives.
>
> For example, we would rewrite the read: method like:
> IndexedSlot>>read: anObject
>         ^ thisContext object: anObject instVarAt: index
>
> Do you agree? Can I open an issue for this? I think this is important.
>
> Yes, please.

Ok, I created the issue and the associated fix:
https://pharo.fogbugz.com/f/cases/17899/Slots-should-not-send-messages-to-the-parent-objects

> But does not thisContext degrades performance?  
> Guille extracted mirror primitives to separate class MirrorPrimitives (project Mirror in Pharo repo). I think we should start to use it and move away from context.

I know about the Mirror project, but as long as it is not part of the Core, we cannot use it for Slots :).

Cheers,
Doru




--
www.tudorgirba.com
www.feenk.com

"We are all great at making mistakes."









Reply | Threaded
Open this post in threaded view
|

Re: problem with slots on proxies

stepharo
In reply to this post by Denis Kudriashov

what is the status of Ghost?

Because we should get a good (and this implies documented) proxy model

Stef


Le 27/3/16 à 18:47, Denis Kudriashov a écrit :
Hi

2016-03-26 21:54 GMT+01:00 Tudor Girba <[hidden email]>:
Hi,

I am trying to play with some proxies that inherit from ProtoObject have slots. For example, I try to do this, but I get an error:

ProtoObject subclass: #BBB
        instanceVariableNames: 'variable'
        classVariableNames: ''
        package: 'BBB'.
BBB class allSlots first read: BBB new

The problem is that the slot sends messages to its parent object, such as:
IndexedSlot>>read: anObject
        ^ anObject instVarAt: index

This is a problem because a similar scenario happens also when you open a debugger on a proxy that tries to communicate with a remote image.

I think that instead of sending messages to the receiver, we should make the slot work with the mirror primitives.

For example, we would rewrite the read: method like:
IndexedSlot>>read: anObject
        ^ thisContext object: anObject instVarAt: index

Do you agree? Can I open an issue for this? I think this is important.

Yes, please.
But does not thisContext degrades performance?   
Guille extracted mirror primitives to separate class MirrorPrimitives (project Mirror in Pharo repo). I think we should start to use it and move away from context.