[Cuis-dev] Class Stub generation with method compilation and correct addition to methodDictionary ( was Re: [Cryptography Team] Design evolution (was Re: Re: [Recovered] AGAIN! This is the third /efourth time

rabbit rabbit at callistohouse.org
Thu Jul 13 16:49:52 PDT 2023


Hey. I started this thread due to my corrupting my image and changes when generating classes and compiling methods incorrectly.

Would someone be able to guide me through correct class and method generation, please?

Gratefully,
rabbit ❤️‍🔥🐰

>>> On Sun, Jul 9, 2023 at 11:55, rabbit via Cuis-dev <[cuis-dev at lists.cuis.st](mailto:On Sun, Jul 9, 2023 at 11:55, rabbit via Cuis-dev <<a href=)> wrote:
>>>
>>>> Hey, I am a touch frustrated. Recovered with <49>. The code I wrote to generate classes and methods has been corrupting my image, or rather mucking to the changes. I was having old code versions being loaded and breaking bad. I was publishing a lot of garbage because when running the BoxOfKittens, I was generating several SharedNears, now called Neighbors. This subclass generation and the method compilation is being done it the following methods...I am just going to leave it turned off for now and stay focused on my objective. It is an example of corruption occurring, if that helps anyone. If one could tell me how to better generate these artifacts, that would be outstanding!•
>>>>
>>>> •••
>>>>
>>>> The #buildOnClass is called from a class creation method
>>>>
>>>>> buildOnClass: eClazz
>>>>>
>>>>> |refClass |
>>>>> refClass := self stubClass
>>>>> subclass: (eClazz name, 'Stub') asSymbol
>>>>> instanceVariableNames: ''
>>>>> classVariableNames: ''
>>>>> poolDictionaries: ''
>>>>> category: self userClassCategoryString.
>>>>>
>>>>> "Copy all methods, up to Object, to the new refClass, with redirectMessage forwarding."
>>>>> self copyMethodsToClass: refClass fromClass: eClazz upToClass: Object.
>>>>>
>>>>> ^ refClass
>>>>
>>>>> •••
>>>>
>>>>> copyMethodsToClass: refClass fromClass: valueClazz upToClass: rootClass
>>>>
>>>>> | arguments classes newMethodString |
>>>>> "Collect classes to contribute message protocol."
>>>>> classes := valueClazz allSuperclasses select: [ :clazz | (Object ~~ rootClass) and: [ Object inheritsFrom: clazz] ].
>>>>>
>>>>> "contribute message protocols."
>>>>> classes do: [:thisClazz |
>>>>> thisClazz methodDictionary keysAndValuesDo: [:selector :method |
>>>>> arguments := method tempNames first: method numArgs.
>>>>> newMethodString := self buildForwardingMethod: selector contents arguments: arguments.
>>>>> Compiler
>>>>> compile: newMethodString
>>>>> environment: refClass environment
>>>>> notifying: nil
>>>>> trailer: method trailer
>>>>> ifFail: [nil]]].
>>>>>
>>>>> •••
>>>>>
>>>>> buildForwardingMethod: selector arguments: arguments
>>>>>
>>>>> | argumentString selectorStream |
>>>>> argumentString := ((arguments inject: ''writeStream into: [:stream :argument | stream nextPutAll: argument, ' ']) contents).
>>>>> selectorStream := '' writeStream.
>>>>> (selector subStrings: $:) with: arguments do: [:keyword :argument | selectorStream nextPutAll: keyword, ': ', argument, ' '].
>>>>> ^ selectorStream contents, '
>>>>>
>>>>> ^self redirectMessage: (Message selector: ', selector asSymbol printString, ' arguments: #{', argumentString, '}).'
>>>>
>>>> Alright then,
>>>>
>>>> --
>>>> ••• rabbit ❤️‍🔥🐰
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230713/6143fee8/attachment.htm>


More information about the Cuis-dev mailing list