[squeak-dev] Can i has underscores? :)
Alexander Lazarević
laza at blobworks.com
Wed Apr 14 12:19:58 UTC 2010
I think there are two problems here. First that the Scanner returns a
b instVars on reading a_b when "Allow underscore selectors" is false
and second that it just honors the global setting for "allow
underscore selectors" in the Prefs. The Parser also checks for a class
side method allowUnderscoreSelectors.
Alex
2010/4/14 Igor Stasenko <siguctua at gmail.com>:
> On 14 April 2010 13:44, Alexander Lazarević <laza at blobworks.com> wrote:
>> 2010/4/14 Igor Stasenko <siguctua at gmail.com>:
>>> Is there an option to use a per-class setting, instead/in addition of
>>> a system-wide one?
>>
>> Haven't tested this but Behavior>>allowUnderscoreSelectors suggests so:
>>
>> "Return true if the receiver and its subclasses should be allowed to
>> use underscore in selectors. Returning nil here means that the
>> compiler should use the system-wide default preference. Also see
>> #allowUnderscoreAssignments.
>>
>> Combinations: If both preferences are false, underscore is illegal.
>> If both preferences are true, underscore assignment needs the be
>> surrounded by spaces and a single underscore cannot be used as
>> selector."
>> ^nil
>>
>
> Oh , well it seems works only for selectors, but not for ivars/classvars :(
> i put the
> MyClass class>>allowUnderscoreSelectors
> ^ true
>
> on previously defined MyClass, and then tried to add ivar with underscores:
>
> Object subclass: #MyClass
> instanceVariableNames: 'a_b_c'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'OpenGL-Specs'
>
> after accepting it, i got no error (what is strange), but instead ,
> the class having 3 ivars:
>
> Object subclass: #MyClass
> instanceVariableNames: 'a b c'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'OpenGL-Specs'
>
>
> This is inconsistent. It should either throw an error or accept the
> variable name with underscore, but not silently turn
> 'a_b_c' into 3 separate ivars.
>
>> Alex
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>
More information about the Squeak-dev
mailing list
|