<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 2013-09-11, at 23:14, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div><div><div><div><div><div>After verification, xColon is not so rare, it is invoked for every block argument...<br>But we can safely replace (token := self step asSymbol) with (token := String with: self step), no problem.<br>
</div><br>We can even change it to (token := self step) if we are willing to remove last scories of alternate selectors beginning with $:<br>
</div><div>Indeed, #: and #:x are obsolete squeakism which would not compile in other dialects (#':' and #':x' is the universally correct syntax).<br></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Well, all Squeak-derived dialects still do support it. Pharo changed the printString of #: to #':', while Squeak and Cuis still print #:. And they all accept #:, #:x, and #:x:::.</div><div><br></div><blockquote type="cite"><div dir="ltr"><div><div><div><div><div><div><div>Removing this feature consists in</div>- removing #colon reference in xLitQuote scanLitWord scanLitVec scanAllTokenPosition <br>
- removing asSymbol send in xColon.<br></div></div></div></div></div></div></div></blockquote><div><br></div>+ changing printing for Symbol</div><div><br><blockquote type="cite"><div dir="ltr"><div><div><div><div><div><div>But that would imply that methods with #: or #:x literals would not compile anymore</div></div>And that #( :x ) would result in #( #':' #x ) instead of #( #':x' ).<br>
</div>After my last hacking this would be a safe change in trunk (at least Compiler recompileAll works) and I'm all for it, <br>... but who knows what could happen to exotic third-party code.<br></div><div>Having code load request resulting in a SyntaxError popping up is just one of the most annoying thing...<br>
</div><div>And having interpretation of a literal changing without any sort of indication is not much better!<br><br></div>#: would still be supported with (Scanner prefAllowUnicharSymbol: true) but not #:x<br></div></div></div></blockquote><div><br></div><div>What else would the pref allow? #: is the only thing I've seen "in the wild" (occurring in Etoys, OMeta, and DrGeo)</div><div><br></div><blockquote type="cite"><div dir="ltr"><div>Maybe we could make it a preference too for smoother migration?<br>
</div>Or some sort of disambiguating request if interactive and conservative behavior if not, like I did for 1@-2?</div></blockquote><div><br></div><div>That would seem like the user-friendliest option, better than a preference IMHO. </div><div><br></div><div>- Bert -</div><br><blockquote type="cite"><div dir="ltr"><div><div class="gmail_extra">Thoughts?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2013/9/11 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div>Ah right, thanks Bert.<br></div>I think that the send of xColon is rare anyway (assignment cases := apart, in which case we do not send asSymbol)<br>
<br></div><div>#':' is not referred directly in the Compiler stuff:<br>
</div>Let's see: (SystemNavigation default browseAllCallsOn: #':') -> Oops yet another bug<br></div>See fix attached<br><br></div>Though I think asSymbol is necessary given implementation of scanLitWord, I'll look deeper later<br>
<div><br><br></div></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/11 Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>Another sender used to be #xColon. Not sure if we need to worry about that one.</div>
<div><br></div><div>CharAsSymbolSenders sortedCounts</div><div>==> {6474->#scanToken . 141->#xColon}</div><div><br></div><div>(this was from before your compiler changes)</div><span><font color="#888888">
<br><div><span style="border-collapse:separate;border-spacing:0px;font-size:12px"><div style="font-family:Helvetica">- Bert -</div><br></span></div></font></span><div><div><div>On 2013-09-06, at 01:58, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr">Thanks Bert, I just published a Compiler version that does not...<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/5 Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div>On 2013-09-04, at 21:41, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr">A rapid review of senders indicates that Character asSymbol seems rather rare in a trunk image.<br><br>I found <br>#initTextConstants<br>#inOutdent:delta: (Character tab asSymbol asText which is rather crooked way of avoiding an allocation - String tab would allocate a new Object).</div>
</blockquote><div><br></div></div><div>Scanner>>scanToken appears to be the most often used sender, and may well be the original reason for caching the 1-char symbols.</div><div><br></div><div>It might be a good idea to time compilation of complex methods with and without OneCharacterSymbols. (my guess is it wouldn't make much of a difference these days)</div>
<span><font color="#888888"><div><br></div><div><span style="font-family:Helvetica;font-size:12px">- Bert -</span></div></font></span><div><div><span style="font-family:Helvetica;font-size:12px"><br>
</span></div><br><blockquote type="cite"><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/4 Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
There's another user of OneCharacterSymbols: Character >> #asSymbol. I don't know how often it's used (my guess is that it's rarely used), or how much slower it would be, if we were removing OneCharacterSymbols. The implementation would change from<br>
<br>
^Symbol internCharacter: self<br>
<br>
to<br>
<br>
^Symbol intern: self asString<br>
<br>
Which means that an extra String will be created, and the lookup is done in the WeakSets, instead of an Array/WeakArray.<br>
<br>
<br>
Levente<br>
<br>
On Wed, 4 Sep 2013, Nicolas Cellier wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Well, as you were the last modifier, I prefer to have your advice :)<br>
<br>
Nicolas<br>
<br>
<br>
2013/9/4 Levente Uzonyi <<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>><br>
On Wed, 4 Sep 2013, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
A new version of Collections was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-nice.530.mcz" target="_blank">http://source.squeak.org/<u></u>inbox/Collections-nice.530.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-nice.530<br>
Author: nice<br>
Time: 4 September 2013, 2:21:28.852 am<br>
UUID: d732aa23-1c77-4c1e-abc0-<u></u>d8d4506b7f9f<br>
Ancestors: Collections-ul.529<br>
<br>
Fix this:<br>
self assert: (allSymbols select: [:s | s = '+']) size = 1.<br>
<br>
1) It is un-necessary to enumerate the 1-char symbols, they already are in SymbolTable (the first time they were created via #findIntern: or by virtue of last #rehash) !<br>
<br>
2) We can use a WeekArray rather than an Array because there is no point in keeping a reference to unused 1-char symbols.<br>
<br>
Maybe we should get rid of OneCharacterSymbols class var, but I didn't dare...<br>
<br>
<br>
I say we should nuke it. The only user is Symbol class >> #selectorsContaining:, but that method is pretty much broken:<br>
- it uses OneCharacterSymbols only for infix selectors<br>
- it can't find infix selectors longer than 2 characters<br>
- it tries to optimize some stuff, but wastes cycles on other stuff<br>
<br>
<br>
Levente<br>
<br>
<br>
=============== Diff against Collections-ul.529 ===============<br>
<br>
Item was changed:<br>
----- Method: Symbol class>>allSymbols (in category 'access') -----<br>
allSymbols<br>
"Answer all interned symbols"<br>
^Array streamContents:[:s|<br>
s nextPutAll: NewSymbols.<br>
- s nextPutAll: OneCharacterSymbols.<br>
s nextPutAll: SymbolTable.<br>
].<br>
!<br>
<br>
Item was changed:<br>
----- Method: Symbol class>>initialize (in category 'class initialization') -----<br>
initialize<br>
<br>
"Symbol initialize"<br>
<br>
Symbol rehash.<br>
+ OneCharacterSymbols := WeakArray new: 256.<br>
+ (0 to: 255) do: [ :byte | byte asCharacter asSymbol].<br>
- OneCharacterSymbols := nil.<br>
- OneCharacterSymbols := (1 to: 256) collect: [ :i | (i - 1) asCharacter asSymbol].<br>
Smalltalk addToShutDownList: self.<br>
!<br>
<br>
Item was changed:<br>
----- Method: Symbol class>>internCharacter: (in category 'instance creation') -----<br>
internCharacter: aCharacter<br>
aCharacter asciiValue > 256 ifTrue:[^self intern: aCharacter asString].<br>
+ ^(OneCharacterSymbols at: aCharacter asciiValue + 1) ifNil: [OneCharacterSymbols at: aCharacter asciiValue + 1 put: (self intern: aCharacter asString)]<br>
- OneCharacterSymbols ifNil: [^self intern: aCharacter asString].<br>
- ^OneCharacterSymbols at: aCharacter asciiValue + 1<br>
!<br>
<br>
Item was changed:<br>
----- Method: Symbol class>>selectorsContaining: (in category 'access') -----<br>
selectorsContaining: aString<br>
"Answer a list of selectors that contain aString within them. Case-insensitive. Does return symbols that begin with a capital letter."<br>
<br>
| size selectorList ascii |<br>
<br>
selectorList := OrderedCollection new.<br>
(size := aString size) = 0 ifTrue: [^selectorList].<br>
<br>
aString size = 1 ifTrue:<br>
[<br>
ascii := aString first asciiValue.<br>
+ ascii < 128 ifTrue: [(OneCharacterSymbols at: ascii+1) ifNotNil: [:s | selectorList add: s]]<br>
- ascii < 128 ifTrue: [selectorList add: (OneCharacterSymbols at: ascii+1)]<br>
].<br>
<br>
(aString first isLetter or: [aString first isDigit]) ifFalse:<br>
[<br>
aString size = 2 ifTrue:<br>
[Symbol hasInterned: aString ifTrue:<br>
[:s | selectorList add: s]].<br>
^selectorList<br>
].<br>
<br>
selectorList := selectorList copyFrom: 2 to: selectorList size.<br>
<br>
self allSymbolTablesDo: [:each |<br>
each size >= size ifTrue:<br>
[(each findSubstring: aString in: each startingAt: 1<br>
matchTable: CaseInsensitiveOrder) > 0<br>
ifTrue: [selectorList add: each]]].<br>
<br>
^selectorList reject: [:each | "reject non-selectors, but keep ones that begin with an uppercase"<br>
each numArgs < 0 and: [each asString withFirstCharacterDownshifted numArgs < 0]].<br>
<br>
"Symbol selectorsContaining: 'scon'"!<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br><br>
<br></blockquote></div><br></div>
<br></blockquote></div></div><div><span style="border-collapse:separate;border-spacing:0px;font-size:12px"><br></span>
</div>
<br></div><br><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div><br><br>
<br></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div>
<br></blockquote></div><br></body></html>