<div dir="ltr">Hmm, I think we are mixing stuff here ^^<br><br>Method Dictionaries and system dictionary accept any object as keys.<div><br></div><div>To execute code, the VM only checks for identity (+ identity hash that does not change) in method dictionaries. The VM never looks up in the system dictionary.</div><div>Actually the VM does not make any assumption on the objects you put as keys. This makes the VM simpler.</div><div><span style="font-size:13.1999998092651px;line-height:1.5">Then tools enforce that we put there symbols as keys in both. But, we could put anything we would like.</span><br></div><div><span style="font-size:13.1999998092651px;line-height:1.5"><br></span></div><div><span style="font-size:13.1999998092651px;line-height:1.5">So, answering your questions:</span></div><div><span style="font-size:13.1999998092651px;line-height:1.5"><br></span></div><div><span style="font-size:13.1999998092651px;line-height:19.7999992370605px">1. Are bindings with keys that are not ByteString or ByteSymbol valid?</span></div><div><br></div><div> Theoretically yes, but nobody uses this for real for now. Camille has some prototypes that uses this to enforce modularity.</div><div><br style="font-size:13.1999998092651px;line-height:19.7999992370605px"><span style="font-size:13.1999998092651px;line-height:19.7999992370605px">2. Should we keep allowing ByteString as keys to globals (ByteSymbol guarantees identity)?</span></div><div><br></div><div> Well, usually the tools will make sure that you transform them to a symbol before.</div><div><br style="font-size:13.1999998092651px;line-height:19.7999992370605px"><span style="font-size:13.1999998092651px;line-height:19.7999992370605px">3. If we allow ByteString, do we also allow WideString?</span></div><div><br></div><div> Any object ^^</div><div><br style="font-size:13.1999998092651px;line-height:19.7999992370605px"><span style="font-size:13.1999998092651px;line-height:19.7999992370605px">4. Would “type checks” on SystemDictionary incur a big performance penalty?</span><span style="font-size:13.1999998092651px;line-height:1.5"><br></span></div><div><span style="font-size:13.1999998092651px;line-height:19.7999992370605px"><br></span></div><div><span style="font-size:13.1999998092651px;line-height:19.7999992370605px"> Maybe, but not only that. It makes the code more messy also, and hardcode tool assumptions. I don't put any type checks in any of my code usually, why start there... We should fix fuel to not make that assumption instead I think.</span></div></div><br><div class="gmail_quote">El dom., 5 de abr. de 2015 a la(s) 8:40 p. m., Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> escribió:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-04-04 14:55 GMT+02:00 Max Leske <span dir="ltr"><<a href="mailto:maxleske@gmail.com" target="_blank">maxleske@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On 31 Mar 2015, at 23:12, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:</div><br></blockquote><div><br></div>Thanks Nicolas. I was hoping to see a bit more activity on this thread so I didn’t reply immediately.</div><div><br><blockquote type="cite"><div><div dir="ltr"><div><div>not only the globals but the methods in MethodDictionary too :)<br></div></div></div></div></blockquote><div><br></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></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Nope, no problem, I think we just use the identityHash, so nowhere a symbol is required.<br></div><div>It's only a problem at higher level, image-side, for IDE.<br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div dir="ltr"><div>It might be a feature, it's just that it's unused because of limited IDE and compiler.<br></div></div></div></blockquote><div><br></div><div>If you look far enough, almost anything can be considered a feature… :)</div><br><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-31 20:49 GMT+02:00 Max Leske <span dir="ltr"><<a href="mailto:maxleske@gmail.com" target="_blank">maxleske@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
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>
<br>
class := Class new<br>
setName: 4;<br>
yourself.<br>
Smalltalk<br>
at: class name<br>
put: class.<br>
<br>
So we now have a class with name 4 (which is a SmallInteger):<br>
<br>
self assert: (Smalltalk at: 4) == class.<br>
<br>
<br>
There are basically two different issues:<br>
1. SystemDictionary will store any kind of association, not only symbols / strings<br>
2. SystemDictionary is an IdentityDictionary and as such two equivalent but not identical keys will not resolve to the same object:<br>
<br>
class := Class new<br>
setName: (String streamContents: [ :s | s nextPutAll: 'someName']);<br>
yourself.<br>
Smalltalk<br>
at: class name<br>
put: class.<br>
<br>
Smalltalk<br>
at: (String streamContents: [ :s | s nextPutAll: 'someName’])<br>
ifAbsent: [ false ]. “——> false”<br>
<br>
<br>
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>
It would help us a lot if we could clear up the semantics of bindings in SystemDictionary:<br>
1. Are bindings with keys that are not ByteString or ByteSymbol valid?<br>
2. Should we keep allowing ByteString as keys to globals (ByteSymbol guarantees identity)?<br>
3. If we allow ByteString, do we also allow WideString?<br>
4. Would “type checks” on SystemDictionary incur a big performance penalty?<br>
<br>
<br>
Any suggestions are welcome.<br>
<br>
Cheers,<br>
Max<br>
</blockquote></div><br></div>
</div></blockquote></div><br></div><br></blockquote></div></div></div></blockquote></div>