[squeak-dev] miss-used become: ???

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Sat Jun 9 15:17:31 UTC 2012


Try this

String>>becomeB
    self become: 'b'.
    ^self first

^'a' becomeB

Nicolas

2012/6/9 Chris Muller <asqueaker at gmail.com>:
> Does become: swap the references in the currently executing MethodContext too?
>
>
> On Fri, Jun 8, 2012 at 4:34 PM, Nicolas Cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
>> UnscriptedPlayer>>assureUniClass
>>        "Create a uniclass and become the receiver into it"
>>
>>        | anInstance |
>>        anInstance := self rootClassForUniclasses instanceOfUniqueClass.
>>        anInstance initializeCostumesFrom: self.
>>        self become: anInstance.
>>        ^ anInstance
>>
>> As I understand it, after the become: self is anInstance and anInstance is self.
>> So this would answer the original UnscriptedPlayer before the become...
>> Is this really the intention?
>> Otherwise, becomeForward: would work better.
>>
>> Nicolas
>>
>


More information about the Squeak-dev mailing list