problem with slots on proxies
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."
Hi 2016-03-26 21:54 GMT+01:00 Tudor Girba <tudor@tudorgirba.com>:
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.
Hi,
On Mar 27, 2016, at 6:47 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi
2016-03-26 21:54 GMT+01:00 Tudor Girba <tudor@tudorgirba.com>: 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-th...
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."
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 <tudor@tudorgirba.com <mailto:tudor@tudorgirba.com>>:
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.
participants (3)
-
Denis Kudriashov -
stepharo -
Tudor Girba