[squeak-dev] CompiledBlocks are fascinating
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Sat Apr 18 17:31:48 UTC 2020
class := Object newSubclass.
class addSelector: #foo: withMethod: (
[:x | x squared * 2] method as: CompiledMethod).
class new foo: 3. "18"
And you can even debug it :D
[cid:7a66b4ce-902b-45c2-bb25-83d2d7126d20]
This one is really crazy:
class := Object newUniqueClassInstVars: 'state' classInstVars: ''.
class addSelector: #foo withMethod: (
[:x | gate] method as: CompiledMethod).
class new foo "-1.2045729113346377e-38"
What the ...? Am I accessing any private method literals here?
Then we only need a mechanism that translates the #pushRcvr: bytecodes to another class.
Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200418/baa6433d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 1857 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200418/baa6433d/attachment.png>
More information about the Squeak-dev
mailing list
|