<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 31 Mar 2015, at 23:12, Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" class="">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"></blockquote><div><br class=""></div>Thanks Nicolas. I was hoping to see a bit more activity on this thread so I didn’t reply immediately.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="">not only the globals but the methods in MethodDictionary too :)<br class=""></div></div></div></div></blockquote><div><br class=""></div><div>Ok, that might even be worse. AFAIK MethodDictionary is treated as a special class by the VM. So storing other objects in there may be a real problem, not just a philosphical one. CC’ing vm-dev on this.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">It might be a feature, it's just that it's unused because of limited IDE and compiler.<br class=""></div></div></div></blockquote><div><br class=""></div><div>If you look far enough, almost anything can be considered a feature… :)</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">2015-03-31 20:49 GMT+02:00 Max Leske <span dir="ltr" class="">&lt;<a href="mailto:maxleske@gmail.com" target="_blank" class="">maxleske@gmail.com</a>&gt;</span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br class="">
<br class="">
Tommaso and I, while hacking on Fuel, today discovered that globals in Pharo can have very weird bindings (I guess some of you already know that). For example:<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; class := Class new<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setName: 4;<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yourself.<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; Smalltalk<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at: class name<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; put: class.<br class="">
<br class="">
So we now have a class with name 4 (which is a SmallInteger):<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; self assert: (Smalltalk at: 4) == class.<br class="">
<br class="">
<br class="">
There are basically two different issues:<br class="">
1. SystemDictionary will store any kind of association, not only symbols / strings<br class="">
2. SystemDictionary is an IdentityDictionary and as such two equivalent but not identical keys will not resolve to the same object:<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; class := Class new<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setName: (String streamContents: [ :s | s nextPutAll: 'someName']);<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; yourself.<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; Smalltalk<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at: class name<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; put: class.<br class="">
<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; Smalltalk<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at: (String streamContents: [ :s | s nextPutAll: 'someName’])<br class="">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifAbsent: [ false ]. “——&gt; false”<br class="">
<br class="">
<br class="">
In Fuel we simply assume that any key to a global is either a ByteString or ByteSymbol. If that’s not the case bad things happen.<br class="">
It would help us a lot if we could clear up the semantics of bindings in SystemDictionary:<br class="">
1. Are bindings with keys that are not ByteString or ByteSymbol valid?<br class="">
2. Should we keep allowing ByteString as keys to globals (ByteSymbol guarantees identity)?<br class="">
3. If we allow ByteString, do we also allow WideString?<br class="">
4. Would “type checks” on SystemDictionary incur a big performance penalty?<br class="">
<br class="">
<br class="">
Any suggestions are welcome.<br class="">
<br class="">
Cheers,<br class="">
Max<br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>