[squeak-dev] Can i has underscores? :)

Juan Vuletich juan at jvuletich.org
Thu Apr 15 12:09:39 UTC 2010


Igor Stasenko wrote:
> On 14 April 2010 20:10, Juan Vuletich <juan at jvuletich.org> wrote:
>   
>> Alexander Lazarević wrote:
>>     
>>> After setting the "Allow underscore selectors" preference to true in
>>> 4.1.1 I just created a class MyClass with the method foo_bar and
>>> MyClass new foo_bar returns 10?!
>>>
>>> I can't say why the note about the new sources file pops up on this
>>> though.
>>>
>>> Alex
>>>
>>>       
>> Hi Folks,
>>
>> I recently integrated Andreas' last changes to Cuis. Today I tried Igor's
>> example and found a few problems, that the attached changes address. This
>> stuff was done for Cuis, but should be easy to integrate in Squeak (and I
>> guess Pharo too). Everybody feel free to integrate and test.
>>
>> 0489-ConfigurableUnderscoreShoutSupport-jmv.5.cs - Adds Shout support for
>> #allowUnderscoreAssignments and #allowUnderscoreSelectos preference
>> 0490-ConfigurableUnderscoreFixes-jmv.3.cs - Fixes some issues when parsing
>> underscores in identifiers in .cs files. Does so by simplifying Scanner.
>> Also makes #a_b to print correctly. With these fixes, such weird stuff as
>> TestUnderscores.cs can be parser and installed.
>> 0491-ConfigurableUnderscoreElsewhere-jmv.1.cs Fixes senders of #isLetter and
>> #isAlphaNumeric that should also consider underscores.
>>
>>     
>
> Juan, i tried to file-in your changesets into a Squeak and got some errors:
>
> In  0490-ConfigurableUnderscoreFixes-jmv.3.cs
> - classDefinition: #Scanner category: #'Compiler-Kernel'
> is not a valid smalltalk expression
> next i tried to install things selectively and stumbled upon:
> Parser>>DNU: #classEncoding
> in debugger, somehow an encoder ivar holds an instance of Parser:
>
> allowUnderscoreAssignments
> 	"Query class + preference"
> 	^encoder classEncoding allowUnderscoreAssignments
> 		ifNil:[super allowUnderscoreAssignments]
>
> my guess this is because of reshaping the Scanner class, which leads
> to a mess in existing Parser
> instances ivars.
>
> So, i think for a correct filein, it should create a separate
> NewScanner and NewParser classes,
> file them in, and only then , atomically rename them  to Scanner and Parser.
>
>   

Note that that file also includes definitions of 
#allowUnderscoreAssignments and #allowUnderscoreSelectors to deal with 
that situation. So, load them first.

Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list