[Cuis-dev] question regarding become: on self

Hernán Wilkinson hernan.wilkinson at 10pines.com
Mon Feb 26 04:04:44 PST 2024


Hi David,
 The exception that is signaled is MethodInCallStackToBecomeInvalid.
 It means that there is a method context in the stack that has a reference
to the object you want to "become", in this case it is self.
 Doing a become in such a condition can produce problems (I do not remember
the exact details of them, but something related to the method being jitted
or something like that) and that is why the check and signaling the
exception, but the exception is resumable as you saw. I have never had any
problem resuming that exception under this circumstance.

Cheers
Hernan.


On Mon, Feb 26, 2024 at 6:09 AM David Faitelson via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> Hi dear all,
>
>
>
> I want to use become: to lazily load objects from a database. Something
> along the lines of:
>
>
>
> Stub >> doesNotUnderstand: aMessage
>
>
>
>                 | actual |
>
>
>
>                 actual := “fetch from db”.
>
>
>
>                 self become: actual.
>
>
>
>                 aMessage sendTo: self.
>
>
>
> When I run this code I get an exception, but if I continue despite the
> signal, the operations succeeds and the stub is correctly replaced by the
> actual object.
>
>
>
> Is this specific use of become: safe despite the warning? Or does it work
> by luck and I should seek a different solution? Or perhaps I can use
> become: in some other way to achieve this effect?
>
>
>
> Thanks,
>
> David
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>


-- 

*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240226/a5872ebb/attachment.htm>


More information about the Cuis-dev mailing list