[squeak-dev] The Trunk: Kernel-eem.1367.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Mar 2 16:21:11 UTC 2021


Hi Eliot,


then I think there is an issue with the argument name. In #callPrimitive:, for example, it is named more specifically, maybePrimFailToken. In #doPrimitive:method:receiver:args:, we may feed it with the result of #tryPrimitive:withArgs: which can be anything, not only a context or fail token.


Here is a second example:


Object subclass: #ContextHack

instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'CT-Experiments'.
ContextHack class compile: 'isArray
self error: #hacked'.
ContextHack new class "through"


<http://www.hpi.de/>
Best,
Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Eliot Miranda <eliot.miranda at gmail.com>
Gesendet: Dienstag, 2. März 2021 16:27 Uhr
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Trunk: Kernel-eem.1367.mcz

Hi Christoph,

On Mar 2, 2021, at 5:17 AM, Thiede, Christoph <Christoph.Thiede at student.hpi.uni-potsdam.de> wrote:



Hi Eliot,


thanks for the fix! Sorry for raising the same question again, but wouldn't it still be safer to dispense with the #isArray call here? It allows the simulated code to break out of the simulation by overriding #isArray anywhere.


As I understand it no.  The clue is in the variable name.  contextOrPrimFailToken can only ever be a Context or an Array, so the send of isArray serves only to quickly differentiate between a Context and an Array.  The message doesn’t get sent to any other kinds of object at that point so the concern that other classes may define isArray does not apply here.

I think I posted a proof of concept here: http://forum.world.st/The-Trunk-Kernel-eem-1366-mcz-tp5126558p5126713.html :-)

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Dienstag, 2. Februar 2021 03:57:12
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: Kernel-eem.1367.mcz

Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1367.mcz

==================== Summary ====================

Name: Kernel-eem.1367
Author: eem
Time: 1 February 2021, 6:57:09.713484 pm
UUID: def9aaa1-eb71-4da5-8f86-85856d9b88ad
Ancestors: Kernel-eem.1366

Fix mistake in the previous commit.  Thanks Levente!

=============== Diff against Kernel-eem.1366 ===============

Item was changed:
  ----- Method: Context>>isPrimFailToken: (in category 'private') -----
+ isPrimFailToken: contextOrPrimFailToken
+        "Answer if contextOrPrimFailToken, which will either be a Context object or
+         a primitive fail token (a tuple of the PrimitiveFailToken unique object and
+         a primitive failure code), is the latter. This should only be used with the
+         (possibly indirect) results of Context>>doPrimitive:method:receiver:args:"
+        ^contextOrPrimFailToken isArray
+          and: [contextOrPrimFailToken size = 2
+          and: [(contextOrPrimFailToken at: 1) == PrimitiveFailToken]]!
- isPrimFailToken: anObject
-        ^(self objectClass: anObject) isArray
-          and: [anObject size = 2
-          and: [(anObject at: 1) == PrimitiveFailToken]]!



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210302/b0f259a7/attachment-0001.html>


More information about the Squeak-dev mailing list