[squeak-dev] Request for feedback: mirrors
Igor Stasenko
siguctua at gmail.com
Thu May 24 01:13:06 UTC 2012
On 24 May 2012 02:34, Colin Putney <colin at wiresong.com> wrote:
> On Wed, May 23, 2012 at 5:13 PM, Igor Stasenko <siguctua at gmail.com> wrote:
>> ok, i checked your implementation and now i see where you doing lookup
>
> [snip]
>
>> ObjectVmMirror>>fixedAt: anInteger
>> ^ self execute: GetFixedSlotMethod
>> arguments: {anInteger}
>>
>> where GetFixedSlotMethod is a class variable holding an appropriate
>> CompiledMethod instance,
>> which you can initialize just once at class initialization (and
>> reinitialize if it changes).
>>
>> and #execute:arguments: is method which using prim 188 for executing
>> given method
>> with object as receiver.
>
> Sure, that would be cleaner and a bit faster. I'll make that change, thanks.
>
> I don't think it'll please Eliot though - we still have to get the
> CompiledMethod from *somewhere* even if it's a class variable.
>
i like the concept. it is quite elegant, to my look:
- things like GetFixedSlotMethod & others is actually a VM contracts
which language side must know about
to properly reflect the objects without sending any message to them
(same as VM does).
So you end up with things like
GetObjectBehaviorMethod
GetObjectVarSizeMethod
GetBehaviorSuperclassMethod
GetBehaviorMDMethod
GetBehaviorFormatMethod
etc
i would even create a separate class for that.. which will hold all
those contracts.
So it can be useful for educational purposes too.
> Colin
--
Best regards,
Igor Stasenko.
More information about the Squeak-dev
mailing list
|