pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Proxies cannot be inspected properly in Raw inspector

Open noha opened this issue 3 months ago • 4 comments

When I inspect a soil proxy object the inspector displays the wrong state. The reason for this is that a soil proxy is a direct subclass of ProtoObject. ProtoObject implements #inspectionraw with the implementation

inspectionRaw
	"This is the most basic presentation showing the state of the object"
	<inspectorPresentationOrder: 900 title: 'Raw'>
	^ StRawInspectionPresenter on: self

but in

newInspectorFor: aModel
	| newInspector |

	newInspector := self
		instantiate: aModel defaultObjectInspectorClass
		on: aModel asInspectorModel.

the model (proxy) is asked for #asInspectorModel. #asInspectorModel is defined in Object and not ProtoObject which make the proxy fire and returning the answer of the real object. So there is a mismatch on assumed models which makes the display very weird.

To Reproduce Inspect a ProtoObject descendant

Expected behavior The expected behavior would be either seeing the information that is stored in the proxy or the information stored in object resolved by the proxy. My assumption would be that the Raw inspector is too heavy for ProtoObject. Therefor ProtoObject should have a very basic inspector that does not need extra methods because it knows it is about a ProtoObject. This inspector could be only visible for ProtoObject and not be present when we are at Object level or above.

Version information:

  • Pharo Version 12-13. Did not check p14 but assume it is the same

Expected development cost I think the cost is medium. A special small inspector for ProtoObject could be done that is only returned on ProtoObject. The easiest could be to implement inspectionRaw in ProtoObject and Object.

noha avatar Nov 28 '25 13:11 noha

Thanks. This is important that we fix this!

Ducasse avatar Nov 30 '25 19:11 Ducasse

This is strange to send message to a proxy like object because it forces the system to increase the API and I would like to reduce the API of protoObject so that we get stronger proxy.

Ducasse avatar Nov 30 '25 19:11 Ducasse

On Pharo 14 we have

ProtoObject >> inspectionRaw: aBuilder [
	"This is the most basic presentation showing the state of the object"
	<inspectorPresentationOrder: 900 title: 'Raw'>

	^ aBuilder instantiate: StRawInspectionPresenter on: self 
]

Ducasse avatar Nov 30 '25 19:11 Ducasse

I do not know what is the builder (but I imagine) the design looks better to me. I do not know the cost of backporting this to P13.

Ducasse avatar Nov 30 '25 19:11 Ducasse