[squeak-smalltalk/squeak-object-memory] Conflicts between scope table and undeclared temporaries in compiler (Issue #166)

Christoph Thiede via Squeak-dev <[email protected]> Sun, 02 Aug 2026 14:04:20 -0700
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <squeak-smalltalk/squeak-object-memory/issues/[email protected]>
--===============2468477276614007274==
Content-Type: multipart/alternative;
 boundary="--==_mimepart_6a6fb0d496f38_e51160990c2";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_6a6fb0d496f38_e51160990c2
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

LinqLover created an issue (squeak-smalltalk/squeak-object-memory#166)

Just collecting my findings for now:

```smalltalk
Object>>test

	x.
	self do: [:x | x].
```

--> UnknownVariable: x --> declare method temp --> it is not declared (and remains undeclared in the source code, the compiler emits no bytecode for a single inst var ref anyway)

```smalltalk
Object>>test

	x := 1.
	self do: [:x | x].
```

--> UnknownVariable: x --> declare method temp --> NotImplemented: sizeCodeForStorePop: is not a message appropriate for a UndeclaredVariableNode

```smalltalk
Object>>test

	[x := 1].
	self do: [:x | x].
```

--> UnknownVariable: x --> declare method temp --> NotImplemented: sizeCodeForStorePop: is not a message appropriate for a UndeclaredVariableNode

```smalltalk
Object>>test

	[x := 1].
	self do: [:x | x].
```

--> UnknownVariable: x --> declare block-local temp --> NotImplemented: sizeCodeForStorePop: is not a message appropriate for a UndeclaredVariableNode

```smalltalk
Object>>test

	self do: [:x | x].
	[x := 1].
```

--> `"out of scope ->"x := 1` --> false positive! We could still declare a temporary block variable here.

Can you find more patterns? :-)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/squeak-smalltalk/squeak-object-memory/issues/166
You are receiving this because you are subscribed to this thread.

Message ID: <squeak-smalltalk/squeak-object-memory/issues/[email protected]>
----==_mimepart_6a6fb0d496f38_e51160990c2
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div style=3D"display: flex; flex-wrap: wrap; white-space: pre-wrap; alig=
n-items: center; "><img height=3D"20" width=3D"20" style=3D"border-radius=
:50%; margin-right: 4px;" decoding=3D"async" src=3D"https://avatars.githu=
busercontent.com/u/38782922?s=3D20&amp;v=3D4" /><strong>LinqLover</strong=
> created an issue <a href=3D"https://github.com/squeak-smalltalk/squeak-=
object-memory/issues/166">(squeak-smalltalk/squeak-object-memory#166)</a>=
</div>
<p dir=3D"auto">Just collecting my findings for now:</p>
<div class=3D"highlight highlight-source-smalltalk" dir=3D"auto"><pre cla=
ss=3D"notranslate"><span class=3D"pl-c1">Object</span><span class=3D"pl-k=
">&gt;&gt;</span>test

	x.
	<span class=3D"pl-k">self</span> <span class=3D"pl-c1">do:</span> [<span=
 class=3D"pl-en">:x</span> | x].</pre></div>
<p dir=3D"auto">--&gt; UnknownVariable: x --&gt; declare method temp --&g=
t; it is not declared (and remains undeclared in the source code, the com=
piler emits no bytecode for a single inst var ref anyway)</p>
<div class=3D"highlight highlight-source-smalltalk" dir=3D"auto"><pre cla=
ss=3D"notranslate"><span class=3D"pl-c1">Object</span><span class=3D"pl-k=
">&gt;&gt;</span>test

	x <span class=3D"pl-k">:=3D</span> <span class=3D"pl-c1">1</span>.
	<span class=3D"pl-k">self</span> <span class=3D"pl-c1">do:</span> [<span=
 class=3D"pl-en">:x</span> | x].</pre></div>
<p dir=3D"auto">--&gt; UnknownVariable: x --&gt; declare method temp --&g=
t; NotImplemented: sizeCodeForStorePop: is not a message appropriate for =
a UndeclaredVariableNode</p>
<div class=3D"highlight highlight-source-smalltalk" dir=3D"auto"><pre cla=
ss=3D"notranslate"><span class=3D"pl-c1">Object</span><span class=3D"pl-k=
">&gt;&gt;</span>test

	[x <span class=3D"pl-k">:=3D</span> <span class=3D"pl-c1">1</span>].
	<span class=3D"pl-k">self</span> <span class=3D"pl-c1">do:</span> [<span=
 class=3D"pl-en">:x</span> | x].</pre></div>
<p dir=3D"auto">--&gt; UnknownVariable: x --&gt; declare method temp --&g=
t; NotImplemented: sizeCodeForStorePop: is not a message appropriate for =
a UndeclaredVariableNode</p>
<div class=3D"highlight highlight-source-smalltalk" dir=3D"auto"><pre cla=
ss=3D"notranslate"><span class=3D"pl-c1">Object</span><span class=3D"pl-k=
">&gt;&gt;</span>test

	[x <span class=3D"pl-k">:=3D</span> <span class=3D"pl-c1">1</span>].
	<span class=3D"pl-k">self</span> <span class=3D"pl-c1">do:</span> [<span=
 class=3D"pl-en">:x</span> | x].</pre></div>
<p dir=3D"auto">--&gt; UnknownVariable: x --&gt; declare block-local temp=
 --&gt; NotImplemented: sizeCodeForStorePop: is not a message appropriate=
 for a UndeclaredVariableNode</p>
<div class=3D"highlight highlight-source-smalltalk" dir=3D"auto"><pre cla=
ss=3D"notranslate"><span class=3D"pl-c1">Object</span><span class=3D"pl-k=
">&gt;&gt;</span>test

	<span class=3D"pl-k">self</span> <span class=3D"pl-c1">do:</span> [<span=
 class=3D"pl-en">:x</span> | x].
	[x <span class=3D"pl-k">:=3D</span> <span class=3D"pl-c1">1</span>].</pr=
e></div>
<p dir=3D"auto">--&gt; <code class=3D"notranslate">"out of scope -&gt;"x =
:=3D 1</code> --&gt; false positive! We could still declare a temporary b=
lock variable here.</p>
<p dir=3D"auto">Can you find more patterns? :-)</p>

<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&m=
dash;<br />Reply to this email directly, <a href=3D"https://github.com/sq=
ueak-smalltalk/squeak-object-memory/issues/166?email_source=3Dnotificatio=
ns&amp;email_token=3DBFYAK6MSL3VPIHVG44KDKZT5H6UFJA5CNFSL4Z3JMQ5C6L3HNF2C=
22DVMIXUS43TOVSS6NJQGQ2DINJXGIZDLJTSMVQXG33OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KY=
ZTPN52GK4S7MNWGSY3L">view it on GitHub</a>, or <a href=3D"https://github.=
com/notifications/unsubscribe-auth/BFYAK6MTI7L3QM3OBJ5KNM35H6UFJAVCNFSNUA=
BFKJSXA33TNF2G64TZHM2DKNBYHA3TANRUHNEXG43VMU5TKMBUGQ2DKNZSGI22C5QC">unsub=
scribe</a>.<br />Triage notifications, keep track of coding agent tasks a=
nd review pull requests on the go with GitHub Mobile for <a href=3D"https=
://github.com/notifications/mobile/ios/BFYAK6KFWGZFXMHD7JHYTWD5H6UFJA5CNF=
SL4Z3JMQ5C6L3HNF2C22DVMIXUS43TOVSS6NJQGQ2DINJXGIZDLJTSMVQXG33OVJZXKYTTMNZ=
GSYTFMSSWK5TFNZ2KUZTPN52GK4S7NFXXG">iOS</a> and <a href=3D"https://github=
.com/notifications/mobile/android/BFYAK6MM6GQL4KRILINGHJT5H6UFJA5CNFSL4Z3=
JMQ5C6L3HNF2C22DVMIXUS43TOVSS6NJQGQ2DINJXGIZDLJTSMVQXG33OVJZXKYTTMNZGSYTF=
MSSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA">Android</a>. Download it today!
<br />You are receiving this because you are subscribed to this thread.<i=
mg src=3D"https://github.com/notifications/beacon/BFYAK6LT3ONCY47ZDAAU6ZD=
5H6UFJBFCNFSM6AAAAAC4XG6N3WWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3J=
MTHQAAAAAEWKYTYJUZZGKYLTN5XKU43VMJZWG4TJMJSWI.gif" height=3D"1" width=3D"=
1" alt=3D"" /><span style=3D"color: transparent; font-size: 0; display: n=
one; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: =
0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;sque=
ak-smalltalk/squeak-object-memory/issues/166</span><span>@</span><span>gi=
thub</span><span>.</span><span>com&gt;</span></span></p>

<script type=3D"application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/squeak-smalltalk/squeak-object-memory/issue=
s/166?email_source=3Dnotifications\u0026email_token=3DBFYAK6IDAZUC5NV24Y2=
WQ435H6UFJA5CNFSL4Z3JMQ5C6L3HNF2C22DVMIXUS43TOVSS6NJQGQ2DINJXGIZDLJTSMVQX=
G33OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KWZ3NMFUWYX3DNRUWG2Y",
"url": "https://github.com/squeak-smalltalk/squeak-object-memory/issues/1=
66?email_source=3Dnotifications\u0026email_token=3DBFYAK6IDAZUC5NV24Y2WQ4=
35H6UFJA5CNFSL4Z3JMQ5C6L3HNF2C22DVMIXUS43TOVSS6NJQGQ2DINJXGIZDLJTSMVQXG33=
OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KWZ3NMFUWYX3DNRUWG2Y",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>

----==_mimepart_6a6fb0d496f38_e51160990c2--

--===============2468477276614007274==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
--===============2468477276614007274==--