[Cuis-dev] question regarding become: on self

David Faitelson davidf at afeka.ac.il
Mon Feb 26 01:08:39 PST 2024


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







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240226/7b79d8c6/attachment.htm>


More information about the Cuis-dev mailing list