On Sat, Nov 26, 2011 at 5:05 PM, Noury Bouraqadi <bouraqadi@gmail.com> wrote:
Stef,

You can easily obtain the list by using a Ghost proxy.

Good PhD supervisor that checks student's code :):):)
1) Install the package :
� � � �Gofer new
� � � �squeaksource: 'Marea';
� � � �package: 'GhostProxies';
� � � �package: 'GhostProxiesTests';
� � � �load.

2) uncomment the body of method �SimpleForwarderHandler>>log: aString
� � � �Transcript show: aString; cr.

3) open a transcript

4) create a proxy on any object and play with it
� � � �(ObjectProxy proxyFor: (Object new)) inspect


Be careful that by default there are some debugging methods that I DO NOT forward but rather do something. Check for example the method:

debuggingMessagesToHandle
��� | dict |
��� dict := Dictionary new.
��� dict at: #basicInspect put:#handleBasicInspect:.
��� dict at: #inspect put:#handleInspect:.
��� dict at: #inspectorClass put:#handleInspectorClass:.
��� dict at: #defaultLabelForInspector put:#handleDefaultLabelForInspector:.
��� dict at: #printStringLimitedTo: put: #handlePrintStringLimitedTo:.
��� dict at: #printString put: #handlePrintString:.
��� dict at: #longPrintOn:limitedTo:indent: put: #handleLongPrintOnLimitedToIndent:.
��� ^ dict���

That means that whenever the proxy receives #basicInspect� I do not forward that to the target but instead, the proxy itself executes #handleBasicInspect:
This let me debug with proxies without problem.
That being said, even if the message is not forwarded, it is shown� in the transcript, so for that Stef needs, it should work :)


5) analyze the log on the transcript :-)


On 25 nov. 2011, at 22:19, St�phane Ducasse wrote:

>
> On Nov 25, 2011, at 10:09 PM, Toon Verwaest wrote:
>
>> Ok, I guess I was confused by your initial question: "the methods that I should define in a subclass of ProtoObject so that I can use basicNew"... :)
>
> :)
>
> Yes it is more the methods that I should define to have a usable class (browse, doit, inspect it). I will probably have to do it by try and error.
>
> Stef
>
>>
>> On 11/25/2011 10:05 PM, St�phane Ducasse wrote:
>>> I'm confused.
>>> I'm not creating a class but an instance.
>>> if it would be Behavior basicNew then yes I made sure that we could do Behavior new and not crashing the system back in Squeak.
>>>
>>> On Nov 25, 2011, at 9:45 PM, Toon Verwaest wrote:
>>>
>>>> With the magic number I mean the number that defines the object's structure. It's one of the first 3 instance variables of every class, encoding how many instance variables there are; what kind of object it is supposed to be (normal, array, bytes, words...). Every "class" basically needs 3 instance variables. 1 defines the structure, 1 the superclass, 1 the behavior (method dictionary). I don't know the other; but just look at some class to know what the order is.
>>> Yes format, methodDict, superclass (probably in a different order).
>>> And format is ugly because not explicit and coded in several place like instSpec (berk)
>>>
>>>> And yes, if you want to inspect the object, you'll need to support whatever protocol your inspector is using.
>>>>
>>>> The format is formed as follows:
>>>>
>>>> format
>>>> � �| fieldSize sizeHiBits format |
>>>> � �fieldSize := self fieldSize + 1.
>>>> � �sizeHiBits := fieldSize // 64.
>>>> � �format := sizeHiBits.
>>>> � �format := (format bitShift: 5) + compactClassIndex.
>>>> � �format := (format bitShift: 4) + self instanceSpecification.
>>>> � �format := (format bitShift: 6) + (fieldSize \\ 64).
>>>> � �format := (format bitShift: 1).
>>>> � �^ format
>>>>
>>>> If I read it correctly (just glancing), instance specification specifies if it's arrayed and if it has fields. 0 -> �no fields, not arrayed, 1 -> �fields, not arrayed, 2 -> �arrayed no fields, 3 -> �arrayed fields.
>>>>
>>>>
>>>> HTH,
>>>> Toon
>>>>
>>>> On 11/25/2011 09:31 PM, St�phane Ducasse wrote:
>>>>> Apparently I can do a doit I was naively doing an inspect ;)
>>>>>
>>>>>
>>>>>> Don't you just need the basicNew primitive, and make sure that the "magic number" is set in the object that has the basicNew installed to something that makes sense?
>>>>>>
>>>>> I do not know what is the magic number.
>>>>> I guess that my problem was that I have first to define what is the minimal behavior.
>>>>>
>>>>>
>>>>>> If you want to send messages to the object, probably also best install some dictionary as the method dict instvar.
>>>>>>
>>>>> But I guess that ProtoObject has some behavior since I can browse the class with a browser.
>>>>>
>>>>>
>>>>>
>>>>>> Toon
>>>>>>
>>>>>> On 11/25/2011 09:26 PM, St�phane Ducasse wrote:
>>>>>>
>>>>>>> Hi
>>>>>>> I would like to know the methods that I should define in a subclass of ProtoObject so that I can use basicNew.
>>>>>>> Does any of you have an idea?
>>>>>>>
>>>>>>> Stef
>>>>>>>
>>>
>>
>>
>
>

Noury
--
http://twitter.com/#!/NouryBouraqadi








--
Mariano
http://marianopeck.wordpress.com