[squeak-dev] Accessing temp variables bindings in a BlockClosure
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Apr 19 22:33:54 UTC 2020
> For inspection - I would like the var names to appear in the explorer as the keys (instead of the #basicAt: indexes).
Are you sure you are not actually inspecting a context object?
This is how the explorer on a FullBlockClosure looks in my image:
[cid:3fde778d-12a2-48ce-bc1d-c1a384cae1b6]
This is how its corresponding Context looks like:
[cid:3e83f3a9-eaee-4265-8949-f390489b9097]
But these indexes cannot be mapped directly to the temporaries. Here is a counter-example:
| y |
y := 10.
[| x | y raisedTo: (x := 13) modulo: 42] newProcess
runUntil: [:c | c actualStackSize = 2];
suspendedContext
[cid:a626e7e7-81fc-4516-a428-326d5b89c659]
Contexts also hold "anonymous temps" that are only visible on the stack during execution and depend on the bytecode set.
But we could probably override Context >> #explorerContents in the following way:
[cid:381be31c-8892-4f84-9acd-db43acbb0bb6]
See attachment. :-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Stéphane Rollandin <lecteur at zogotounga.net>
Gesendet: Sonntag, 19. April 2020 23:56 Uhr
An: squeak-dev at lists.squeakfoundation.org
Betreff: Re: [squeak-dev] Accessing temp variables bindings in a BlockClosure
> But I agree that these are no nice solutions at all. I suppose the point
> is that in contrast to literal bindings, temporary variables are never
> actually stored as bindings in the block method. For what purpose do you
> need the bindings?
For inspection - I would like the var names to appear in the explorer as
the keys (instead of the #basicAt: indexes).
The code I am dealing with at the moment is choke-full of nested blocks,
and it is a pain to see the values of the temp vars in the closures. I
am hacking a modified Explorer to better display this particular info,
but I'm having a hard time...
Stef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 17029 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 16246 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 19463 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 19109 bytes
Desc: pastedImage.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Context-explorerContents.st
Type: application/octet-stream
Size: 642 bytes
Desc: Context-explorerContents.st
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200419/35af52a3/attachment-0001.obj>
More information about the Squeak-dev
mailing list
|