[squeak-dev] Accessing argument literals through Compiled Methods.

rabbit rabbit at callistohouse.org
Wed Jan 11 20:26:36 UTC 2023


Thanks! This got me good! I’m still not adding the methods to the class even though they are created. Image attached shows explorer on eventu near reference of newly generated class EArray.

buildNearOn: value vat: vat

|refClass argumentString arguments classes selectorStream |
refClass := ENear
subclass: ('E', value class name) asSymbol
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'PromisesLocalParkland'.

"Collect classes to contribute message protocol."
classes := value class allSubclasses select: [ :clazz | (Object ~~ clazz) and: [ Object inheritsFrom: clazz] ].

"contribute message protocols."
classes do: [:thisClazz |
thisClazz methodDictionary keysAndValuesDo: [:selector :method |
arguments := method tempNames first: method numArgs.
argumentString := ((arguments inject: ''writeStream into: [:stream :argument | stream nextPutAll: argument, ' ']) contents).
selectorStream := '' writeStream.
(selector subStrings: $:) with: arguments do: [:keyword :argument | selectorStream nextPutAll: keyword, ': ', argument, ' '].
Compiler compile: (selectorStream contents, '
^self redirectMessage: (Message selector: ', selector asSymbol printString, ' arguments: ',argumentString, ').')
environment: value class environment notifying: nil trailer: method trailer ifFail: [nil]]].
^ refClass new initializeOnTarget: value vat: vat; yourself.

—
Have a good one; keep it, light.
Kindly, rabbit . .. … ‘…^,^ 🐇🐇🐇

Sent from Callisto House mobile - Ganymede
:: decentralized mobile homeless solutions ::

On Wed, Jan 11, 2023 at 13:46, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:

> Hi Rob,
>
> are you searching for something like this?
>
> aCompiledMethod tempNames first: aCompiledMethod numArgs
>
> Best,
>
> Christoph
>
> ---------------------------------------------------------------
>
> Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Ron Teitelbaum <ron at usmedrec.com>
> Gesendet: Mittwoch, 11. Januar 2023 19:42:51
> An: The general-purpose Squeak developers list
> Betreff: Re: [squeak-dev] Accessing argument literals through Compiled Methods.
>
> Hi Rob,
>
> Do you mean
>
> aCompiledMethod selector?
>
> All the best,
>
> Ron Teitelbaum
>
> On Wed, Jan 11, 2023 at 1:18 PM rabbit <rabbit at callistohouse.org> wrote:
>
>> Hi y’all,
>>
>> Is there a way I could acquire the list of argument names of a CompiledMethod?
>>
>>>> Have a good one; keep it, light.
>> Kindly, rabbit . .. … ‘…^,^ 🐇🐇🐇
>>
>> Sent from Callisto House mobile - Ganymede
>> :: decentralized mobile homeless solutions ::
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230111/608007ff/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5B459A67-FB3B-4FB3-B789-B53075BCC58D.jpg
Type: image/jpeg
Size: 213343 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20230111/608007ff/attachment-0001.jpg>


More information about the Squeak-dev mailing list