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

Igor Stasenko siguctua at gmail.com
Wed Apr 14 11:21:00 UTC 2010


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