Fixing support for selectors with underscores

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Fixing support for selectors with underscores

Levente Uzonyi-2
Hi,

since Squeak 4.1 it's possible [1] to use underscores in class, method and
variable names. System wide support for them is still incomplete though.
There are two reasons for this:
- our developement process doesn't need this feature
- noone wanted to fix it

The per-class scoping causes so much trouble, that I'd like to remove it
completely, leaving only global preferences. Why?
- It doesn't work for
   - class names,
   - class variable names,
   - class side methods.
- It doesn't work with code loading tools (e.g. Monticello), because
there's no guarantee, that #allowUnderscoreSelectors will be loaded before
the methods using underscores that way.
- It doesn't work for tools viewing external code.

Any objections?


Cheers,
Levente

[1] http://forum.world.st/Selectors-with-underscores-Have-your-cake-and-eat-it-too-td1591416.html
[2] http://bugs.squeak.org/view.php?id=7547

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Diogenes Moreira
Well... Glorp and GlorpDBX (squeakDBX's Glorp Port) Package, uses some
accessor with underscore... to maintain compatibility with VW Version

to fix it we have this script
http://www.squeakdbx.org/files/01/315sh0cs3b31mska30xb1nnigblvdu/underscore.cs

I 'm not sure, if that break other thing, but Glorp Work well..

Best


On Mon, May 2, 2011 at 12:49 AM, Levente Uzonyi <[hidden email]> wrote:

> Hi,
>
> since Squeak 4.1 it's possible [1] to use underscores in class, method and
> variable names. System wide support for them is still incomplete though.
> There are two reasons for this:
> - our developement process doesn't need this feature
> - noone wanted to fix it
>
> The per-class scoping causes so much trouble, that I'd like to remove it
> completely, leaving only global preferences. Why?
> - It doesn't work for
>  - class names,
>  - class variable names,
>  - class side methods.
> - It doesn't work with code loading tools (e.g. Monticello), because there's
> no guarantee, that #allowUnderscoreSelectors will be loaded before the
> methods using underscores that way.
> - It doesn't work for tools viewing external code.
>
> Any objections?
>
>
> Cheers,
> Levente
>
> [1]
> http://forum.world.st/Selectors-with-underscores-Have-your-cake-and-eat-it-too-td1591416.html
> [2] http://bugs.squeak.org/view.php?id=7547
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Edgar De Cleene



On 5/2/11 10:21 AM, "Diogenes Moreira" <[hidden email]> wrote:

> Well... Glorp and GlorpDBX (squeakDBX's Glorp Port) Package, uses some
> accessor with underscore... to maintain compatibility with VW Version
>
> to fix it we have this script
> http://www.squeakdbx.org/files/01/315sh0cs3b31mska30xb1nnigblvdu/underscore.cs
>
> I 'm not sure, if that break other thing, but Glorp Work well..
>
> Best
>
>
> On Mon, May 2, 2011 at 12:49 AM, Levente Uzonyi <[hidden email]> wrote:
>> Hi,
>>
>> since Squeak 4.1 it's possible [1] to use underscores in class, method and
>> variable names. System wide support for them is still incomplete though.
>> There are two reasons for this:
>> - our developement process doesn't need this feature
>> - noone wanted to fix it
>>
>> The per-class scoping causes so much trouble, that I'd like to remove it
>> completely, leaving only global preferences. Why?
>> - It doesn't work for
>>  - class names,
>>  - class variable names,
>>  - class side methods.
>> - It doesn't work with code loading tools (e.g. Monticello), because there's
>> no guarantee, that #allowUnderscoreSelectors will be loaded before the
>> methods using underscores that way.
>> - It doesn't work for tools viewing external code.
>>
>> Any objections?
>>
>>
>> Cheers,
>> Levente
>>
>> [1]
>> http://forum.world.st/Selectors-with-underscores-Have-your-cake-and-eat-it-to
>> o-td1591416.html
>> [2] http://bugs.squeak.org/view.php?id=7547
>>
>>


Some days ago we discuss the underscore support in our list
http://ar.groups.yahoo.com/group/squeakRos/

I think we need similar support as Pharo for compatibility and people don't
need do twice his projects.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
In reply to this post by Diogenes Moreira
On Mon, 2 May 2011, Diogenes Moreira wrote:

> Well... Glorp and GlorpDBX (squeakDBX's Glorp Port) Package, uses some
> accessor with underscore... to maintain compatibility with VW Version
>
> to fix it we have this script
> http://www.squeakdbx.org/files/01/315sh0cs3b31mska30xb1nnigblvdu/underscore.cs
>
> I 'm not sure, if that break other thing, but Glorp Work well..

I guess you missed my point. Squeak _has_ support for underscores in
selectors out of the box, you can compile the methods and evaluate them
(after changing the global preference), but the tool support is incomplete
at the moment.

Your patch will break the existing support code and probably won't work at
all, because typeTable doesn't contain #leftArrow anymore.


Levente

>
> Best
>
>
> On Mon, May 2, 2011 at 12:49 AM, Levente Uzonyi <[hidden email]> wrote:
>> Hi,
>>
>> since Squeak 4.1 it's possible [1] to use underscores in class, method and
>> variable names. System wide support for them is still incomplete though.
>> There are two reasons for this:
>> - our developement process doesn't need this feature
>> - noone wanted to fix it
>>
>> The per-class scoping causes so much trouble, that I'd like to remove it
>> completely, leaving only global preferences. Why?
>> - It doesn't work for
>>  - class names,
>>  - class variable names,
>>  - class side methods.
>> - It doesn't work with code loading tools (e.g. Monticello), because there's
>> no guarantee, that #allowUnderscoreSelectors will be loaded before the
>> methods using underscores that way.
>> - It doesn't work for tools viewing external code.
>>
>> Any objections?
>>
>>
>> Cheers,
>> Levente
>>
>> [1]
>> http://forum.world.st/Selectors-with-underscores-Have-your-cake-and-eat-it-too-td1591416.html
>> [2] http://bugs.squeak.org/view.php?id=7547
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
In reply to this post by Edgar De Cleene
On Mon, 2 May 2011, Edgar J. De Cleene wrote:

> Some days ago we discuss the underscore support in our list
> http://ar.groups.yahoo.com/group/squeakRos/
>
> I think we need similar support as Pharo for compatibility and people don't
> need do twice his projects.

We have that already. What we lack is tool support. Fixing the tools will
be simple as soon as we get rid of the ability to use underscores in some
classes and not in others - aka have one smalltalk syntax at a time.


Levente

>
> Edgar
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Tobias Pape
In reply to this post by Levente Uzonyi-2

Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:

> Hi,
>
> since Squeak 4.1 it's possible [1] to use underscores in class, method and variable names. System wide support for them is still incomplete though. There are two reasons for this:
> - our developement process doesn't need this feature
> - noone wanted to fix it
>
> The per-class scoping causes so much trouble, that I'd like to remove it completely, leaving only global preferences. Why?
> - It doesn't work for
>  - class names,
>  - class variable names,
>  - class side methods.
> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
> - It doesn't work for tools viewing external code.
>
> Any objections?

Yes, I think per-class scoping is important.
I think it is valuable to be able to ‘tune’
your sub-tree of the inheritance tree without interference
with the system. I don't think it is wise to force
the whole system to be underscore-selector compatible
because three or so classes (just an example) need them.
Especially, these three classes never know what setting
they are loaded into. Perhaps there is some very old code
that chokes on underscores, so why enable them globally when
it is not needed globally. I'd even opt for the preference
#allowUnderscore* to be implemented on Object, so this is only
virtually global.
   Make as least things global as possible.

You said:
> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.

I would take that as a reason to fix monticello.
It is the same problem for #parserClass #compilerClass
etc.pp. You don't want to remove that support, too, do you?

So Long,
        -Tobias
Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
On Mon, 2 May 2011, Tobias Pape wrote:

>
> Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:
>
>> Hi,
>>
>> since Squeak 4.1 it's possible [1] to use underscores in class, method and variable names. System wide support for them is still incomplete though. There are two reasons for this:
>> - our developement process doesn't need this feature
>> - noone wanted to fix it
>>
>> The per-class scoping causes so much trouble, that I'd like to remove it completely, leaving only global preferences. Why?
>> - It doesn't work for
>>  - class names,
>>  - class variable names,
>>  - class side methods.
>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>> - It doesn't work for tools viewing external code.
>>
>> Any objections?
>
> Yes, I think per-class scoping is important.
> I think it is valuable to be able to ?tune?
> your sub-tree of the inheritance tree without interference
> with the system. I don't think it is wise to force
> the whole system to be underscore-selector compatible
> because three or so classes (just an example) need them.
> Especially, these three classes never know what setting
> they are loaded into. Perhaps there is some very old code
> that chokes on underscores, so why enable them globally when
> it is not needed globally. I'd even opt for the preference
> #allowUnderscore* to be implemented on Object, so this is only
> virtually global.

What would it mean that e.g. a SmallInteger returns true to
#allowUnderscoreSelectors?

>   Make as least things global as possible.

Pharo took the easier way: no underscore assignments. So underscores are
allowed everywhere else. AFAIK they didn't face any problem with this
approach. We have much better backwards compatibility even with the system
wide preferences.

>
> You said:
>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>
> I would take that as a reason to fix monticello.
> It is the same problem for #parserClass #compilerClass

Similar case, but IIRC class side methods are loaded before instance
side ones, so these don't cause any trouble.

> etc.pp. You don't want to remove that support, too, do you?

AFAIK noone proved that per-class scoping is possible to do at all.
How would you fix the case, when a class has underscores in it's name? You
can't load the class side selector, before loading the class itself, can
you?
How would you fix class side methods? You can't add methods to the
metaclass.

Another flaw with the per-class scoping is that not only the implementors,
but the senders/users of such methods/variables/classes has to enable
underscores in selectors.


Levente

>
> So Long,
> -Tobias
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Andreas.Raab
[FWIW, I'm not taking any sides here, just explaining some intentions]

On 5/2/2011 20:28, Levente Uzonyi wrote:

>> You said:
>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded
>>> before the methods using underscores that way.
>>
>> I would take that as a reason to fix monticello.
>> It is the same problem for #parserClass #compilerClass
>
> Similar case, but IIRC class side methods are loaded before instance
> side ones, so these don't cause any trouble.
>
>> etc.pp. You don't want to remove that support, too, do you?
>
> AFAIK noone proved that per-class scoping is possible to do at all.
> How would you fix the case, when a class has underscores in it's name?
> You can't load the class side selector, before loading the class itself,
> can you?
> How would you fix class side methods? You can't add methods to the
> metaclass.

You'd use a different superclass (possibly in a separate package). I've
done similar things quite effectively before. It's a bit icky and
nothing you'd do casually, but if you're porting a larger subsystem it
can be done with reasonable effort. Here's an example of how I'd do it:

Object subclass: #FooObjectStub

FooObjectStub class>>allowUnderscoreSelectors
        ^self ~~ FooObjectStub

etc. This allows one to use the system defaults in FooObjectStub while
providing the proper settings for the subclass tree.

> Another flaw with the per-class scoping is that not only the
> implementors, but the senders/users of such methods/variables/classes
> has to enable underscores in selectors.

Yes. But then again, this was intended to allow porting sizable chunks
of code where one can then deal with the remaining problems as well.

Though, given how little use it has had, I wouldn't claim that it's been
particularly effective :-)

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
On Mon, 2 May 2011, Andreas Raab wrote:

> [FWIW, I'm not taking any sides here, just explaining some intentions]
>
> On 5/2/2011 20:28, Levente Uzonyi wrote:
>>> You said:
>>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded
>>>> before the methods using underscores that way.
>>>
>>> I would take that as a reason to fix monticello.
>>> It is the same problem for #parserClass #compilerClass
>>
>> Similar case, but IIRC class side methods are loaded before instance
>> side ones, so these don't cause any trouble.
>>
>>> etc.pp. You don't want to remove that support, too, do you?
>>
>> AFAIK noone proved that per-class scoping is possible to do at all.
>> How would you fix the case, when a class has underscores in it's name?
>> You can't load the class side selector, before loading the class itself,
>> can you?
>> How would you fix class side methods? You can't add methods to the
>> metaclass.
>
> You'd use a different superclass (possibly in a separate package). I've done
> similar things quite effectively before. It's a bit icky and nothing you'd do
> casually, but if you're porting a larger subsystem it can be done with
> reasonable effort. Here's an example of how I'd do it:
>
> Object subclass: #FooObjectStub
>
> FooObjectStub class>>allowUnderscoreSelectors
> ^self ~~ FooObjectStub
>
> etc. This allows one to use the system defaults in FooObjectStub while
> providing the proper settings for the subclass tree.

I don't see how this alone solves the case of class side methods and class
variables. For classes with underscores in their names it's a bit
cumbersome, because every such class has to have a superclass with such
selector.

>
>> Another flaw with the per-class scoping is that not only the
>> implementors, but the senders/users of such methods/variables/classes
>> has to enable underscores in selectors.
>
> Yes. But then again, this was intended to allow porting sizable chunks of
> code where one can then deal with the remaining problems as well.

What's the point of porting (forking) all projects which use names with
underscores? Wouldn't it be a lot better to use them as they are?


Levente

>
> Though, given how little use it has had, I wouldn't claim that it's been
> particularly effective :-)
>
> Cheers,
>  - Andreas
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Igor Stasenko
In reply to this post by Levente Uzonyi-2
On 2 May 2011 20:28, Levente Uzonyi <[hidden email]> wrote:

> On Mon, 2 May 2011, Tobias Pape wrote:
>
>>
>> Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:
>>
>>> Hi,
>>>
>>> since Squeak 4.1 it's possible [1] to use underscores in class, method
>>> and variable names. System wide support for them is still incomplete though.
>>> There are two reasons for this:
>>> - our developement process doesn't need this feature
>>> - noone wanted to fix it
>>>
>>> The per-class scoping causes so much trouble, that I'd like to remove it
>>> completely, leaving only global preferences. Why?
>>> - It doesn't work for
>>>  - class names,
>>>  - class variable names,
>>>  - class side methods.
>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded before
>>> the methods using underscores that way.
>>> - It doesn't work for tools viewing external code.
>>>
>>> Any objections?
>>
>> Yes, I think per-class scoping is important.
>> I think it is valuable to be able to ?tune?
>> your sub-tree of the inheritance tree without interference
>> with the system. I don't think it is wise to force
>> the whole system to be underscore-selector compatible
>> because three or so classes (just an example) need them.
>> Especially, these three classes never know what setting
>> they are loaded into. Perhaps there is some very old code
>> that chokes on underscores, so why enable them globally when
>> it is not needed globally. I'd even opt for the preference
>> #allowUnderscore* to be implemented on Object, so this is only
>> virtually global.
>
> What would it mean that e.g. a SmallInteger returns true to
> #allowUnderscoreSelectors?
>
>>  Make as least things global as possible.
>
> Pharo took the easier way: no underscore assignments. So underscores are
> allowed everywhere else. AFAIK they didn't face any problem with this
> approach. We have much better backwards compatibility even with the system
> wide preferences.
>

But unable to recompile all classes in system without chances to get a
syntax error,
because some code are imported using one preference and another using
different one.  ;)

>>
>> You said:
>>>
>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded before
>>> the methods using underscores that way.
>>
>> I would take that as a reason to fix monticello.
>> It is the same problem for #parserClass #compilerClass
>
> Similar case, but IIRC class side methods are loaded before instance side
> ones, so these don't cause any trouble.
>
>> etc.pp. You don't want to remove that support, too, do you?
>
> AFAIK noone proved that per-class scoping is possible to do at all.
> How would you fix the case, when a class has underscores in it's name? You
> can't load the class side selector, before loading the class itself, can
> you?
> How would you fix class side methods? You can't add methods to the
> metaclass.
>
> Another flaw with the per-class scoping is that not only the implementors,
> but the senders/users of such methods/variables/classes has to enable
> underscores in selectors.
>

Indeed. A per-class scoping is just an attempt to play nicely, but it
not covers all possible cases of course.

That's why i was always for:
 - uniformly change all sources to use := for assignment, and allow to
use underscore in identifiers/selectors.

 - for legacy code add a code importer tool, which could while
loading, replace relevant _
with := and then proceed as normal.


AFAIK Pharo had little problems with not supporting old underscores at all.
Fixing the source code takes minutes: just fileout .st files (or
whatever), then open your preferable
text editor and replace all '_' occurences with ':=' , except from
rare cases where underscore are
used in comments/string literals .

>
> Levente
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
On Tue, 3 May 2011, Igor Stasenko wrote:

> On 2 May 2011 20:28, Levente Uzonyi <[hidden email]> wrote:
>> On Mon, 2 May 2011, Tobias Pape wrote:
>>
>>>
>>> Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:
>>>
>>>> Hi,
>>>>
>>>> since Squeak 4.1 it's possible [1] to use underscores in class, method
>>>> and variable names. System wide support for them is still incomplete though.
>>>> There are two reasons for this:
>>>> - our developement process doesn't need this feature
>>>> - noone wanted to fix it
>>>>
>>>> The per-class scoping causes so much trouble, that I'd like to remove it
>>>> completely, leaving only global preferences. Why?
>>>> - It doesn't work for
>>>>  - class names,
>>>>  - class variable names,
>>>>  - class side methods.
>>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded before
>>>> the methods using underscores that way.
>>>> - It doesn't work for tools viewing external code.
>>>>
>>>> Any objections?
>>>
>>> Yes, I think per-class scoping is important.
>>> I think it is valuable to be able to ?tune?
>>> your sub-tree of the inheritance tree without interference
>>> with the system. I don't think it is wise to force
>>> the whole system to be underscore-selector compatible
>>> because three or so classes (just an example) need them.
>>> Especially, these three classes never know what setting
>>> they are loaded into. Perhaps there is some very old code
>>> that chokes on underscores, so why enable them globally when
>>> it is not needed globally. I'd even opt for the preference
>>> #allowUnderscore* to be implemented on Object, so this is only
>>> virtually global.
>>
>> What would it mean that e.g. a SmallInteger returns true to
>> #allowUnderscoreSelectors?
>>
>>>  Make as least things global as possible.
>>
>> Pharo took the easier way: no underscore assignments. So underscores are
>> allowed everywhere else. AFAIK they didn't face any problem with this
>> approach. We have much better backwards compatibility even with the system
>> wide preferences.
>>
>
> But unable to recompile all classes in system without chances to get a
> syntax error,
> because some code are imported using one preference and another using
> different one.  ;)
It's the user's responsibility, as usual. Trunk code doesn't use
underscores at all, so recompilation is not an issue IMHO.

>
>>>
>>> You said:
>>>>
>>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded before
>>>> the methods using underscores that way.
>>>
>>> I would take that as a reason to fix monticello.
>>> It is the same problem for #parserClass #compilerClass
>>
>> Similar case, but IIRC class side methods are loaded before instance side
>> ones, so these don't cause any trouble.
>>
>>> etc.pp. You don't want to remove that support, too, do you?
>>
>> AFAIK noone proved that per-class scoping is possible to do at all.
>> How would you fix the case, when a class has underscores in it's name? You
>> can't load the class side selector, before loading the class itself, can
>> you?
>> How would you fix class side methods? You can't add methods to the
>> metaclass.
>>
>> Another flaw with the per-class scoping is that not only the implementors,
>> but the senders/users of such methods/variables/classes has to enable
>> underscores in selectors.
>>
>
> Indeed. A per-class scoping is just an attempt to play nicely, but it
> not covers all possible cases of course.
>
> That's why i was always for:
> - uniformly change all sources to use := for assignment, and allow to
> use underscore in identifiers/selectors.
>
> - for legacy code add a code importer tool, which could while
> loading, replace relevant _
> with := and then proceed as normal.
>
>
> AFAIK Pharo had little problems with not supporting old underscores at all.
> Fixing the source code takes minutes: just fileout .st files (or
> whatever), then open your preferable
> text editor and replace all '_' occurences with ':=' , except from
> rare cases where underscore are
> used in comments/string literals .
You can't be serious about the text editor and find & replace.
FixUnderscores was a crap that did exactly this. No wonder why noone liked
it. We (or at least I) have a proper tool for changing underscore
assignments to ansi ones which is based on Scanner. It's a lot easier to
do the change in in the image IMHO: change the preference, load the code,
replace the assignments, restore the preference.


Levente

>
>>
>> Levente
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Igor Stasenko
2011/5/3 Levente Uzonyi <[hidden email]>:

> On Tue, 3 May 2011, Igor Stasenko wrote:
>
>> On 2 May 2011 20:28, Levente Uzonyi <[hidden email]> wrote:
>>>
>>> On Mon, 2 May 2011, Tobias Pape wrote:
>>>
>>>>
>>>> Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:
>>>>
>>>>> Hi,
>>>>>
>>>>> since Squeak 4.1 it's possible [1] to use underscores in class, method
>>>>> and variable names. System wide support for them is still incomplete
>>>>> though.
>>>>> There are two reasons for this:
>>>>> - our developement process doesn't need this feature
>>>>> - noone wanted to fix it
>>>>>
>>>>> The per-class scoping causes so much trouble, that I'd like to remove
>>>>> it
>>>>> completely, leaving only global preferences. Why?
>>>>> - It doesn't work for
>>>>>  - class names,
>>>>>  - class variable names,
>>>>>  - class side methods.
>>>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded
>>>>> before
>>>>> the methods using underscores that way.
>>>>> - It doesn't work for tools viewing external code.
>>>>>
>>>>> Any objections?
>>>>
>>>> Yes, I think per-class scoping is important.
>>>> I think it is valuable to be able to ?tune?
>>>> your sub-tree of the inheritance tree without interference
>>>> with the system. I don't think it is wise to force
>>>> the whole system to be underscore-selector compatible
>>>> because three or so classes (just an example) need them.
>>>> Especially, these three classes never know what setting
>>>> they are loaded into. Perhaps there is some very old code
>>>> that chokes on underscores, so why enable them globally when
>>>> it is not needed globally. I'd even opt for the preference
>>>> #allowUnderscore* to be implemented on Object, so this is only
>>>> virtually global.
>>>
>>> What would it mean that e.g. a SmallInteger returns true to
>>> #allowUnderscoreSelectors?
>>>
>>>>  Make as least things global as possible.
>>>
>>> Pharo took the easier way: no underscore assignments. So underscores are
>>> allowed everywhere else. AFAIK they didn't face any problem with this
>>> approach. We have much better backwards compatibility even with the
>>> system
>>> wide preferences.
>>>
>>
>> But unable to recompile all classes in system without chances to get a
>> syntax error,
>> because some code are imported using one preference and another using
>> different one.  ;)
>
> It's the user's responsibility, as usual. Trunk code doesn't use underscores
> at all, so recompilation is not an issue IMHO.
>
>>
>>>>
>>>> You said:
>>>>>
>>>>> - It doesn't work with code loading tools (e.g. Monticello), because
>>>>> there's no guarantee, that #allowUnderscoreSelectors will be loaded
>>>>> before
>>>>> the methods using underscores that way.
>>>>
>>>> I would take that as a reason to fix monticello.
>>>> It is the same problem for #parserClass #compilerClass
>>>
>>> Similar case, but IIRC class side methods are loaded before instance side
>>> ones, so these don't cause any trouble.
>>>
>>>> etc.pp. You don't want to remove that support, too, do you?
>>>
>>> AFAIK noone proved that per-class scoping is possible to do at all.
>>> How would you fix the case, when a class has underscores in it's name?
>>> You
>>> can't load the class side selector, before loading the class itself, can
>>> you?
>>> How would you fix class side methods? You can't add methods to the
>>> metaclass.
>>>
>>> Another flaw with the per-class scoping is that not only the
>>> implementors,
>>> but the senders/users of such methods/variables/classes has to enable
>>> underscores in selectors.
>>>
>>
>> Indeed. A per-class scoping is just an attempt to play nicely, but it
>> not covers all possible cases of course.
>>
>> That's why i was always for:
>> - uniformly change all sources to use := for assignment, and allow to
>> use underscore in identifiers/selectors.
>>
>> - for legacy code add a code importer tool, which could while
>> loading, replace relevant _
>> with := and then proceed as normal.
>>
>>
>> AFAIK Pharo had little problems with not supporting old underscores at
>> all.
>> Fixing the source code takes minutes: just fileout .st files (or
>> whatever), then open your preferable
>> text editor and replace all '_' occurences with ':=' , except from
>> rare cases where underscore are
>> used in comments/string literals .
>
> You can't be serious about the text editor and find & replace.
> FixUnderscores was a crap that did exactly this. No wonder why noone liked
> it. We (or at least I) have a proper tool for changing underscore
> assignments to ansi ones which is based on Scanner. It's a lot easier to do
> the change in in the image IMHO: change the preference, load the code,
> replace the assignments, restore the preference.
>
Not a problem. As long as you doing change.
But if you forgetting to do it, then your image contains a mixture of
classes which using different underscore syntax convention
which leads to inability to recompile all classes.

>
> Levente
>
>>
>>>
>>> Levente
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Chris Muller-3
In reply to this post by Levente Uzonyi-2
> You can't be serious about the text editor and find & replace.
> FixUnderscores was a crap that did exactly this. No wonder why noone liked
> it. We (or at least I) have a proper tool for changing underscore
> assignments to ansi ones which is based on Scanner. It's a lot easier to do
> the change in in the image IMHO: change the preference, load the code,
> replace the assignments, restore the preference.

Pretty strong opinion; I have one too.. :)  FixUnderscores was just
TSTTCPW, nothing more.  It got the job done while properly respecting
the accounting information of the changed methods; as it very well
should for this cosmetic, superficial, whimsical, political change.

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Tobias Pape
In reply to this post by Levente Uzonyi-2

Am 2011-05-02 um 20:28 schrieb Levente Uzonyi:

> On Mon, 2 May 2011, Tobias Pape wrote:
>
>>
>> Am 2011-05-02 um 05:49 schrieb Levente Uzonyi:
>>
>>> Hi,
>>>
>>> since Squeak 4.1 it's possible [1] to use underscores in class, method and variable names. System wide support for them is still incomplete though. There are two reasons for this:
>>> - our developement process doesn't need this feature
>>> - noone wanted to fix it
>>>
>>> The per-class scoping causes so much trouble, that I'd like to remove it completely, leaving only global preferences. Why?
>>> - It doesn't work for
>>> - class names,
>>> - class variable names,
>>> - class side methods.
>>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>>> - It doesn't work for tools viewing external code.
>>>
>>> Any objections?
>>
>> Yes, I think per-class scoping is important.
>> I think it is valuable to be able to ?tune?
>> your sub-tree of the inheritance tree without interference
>> with the system. I don't think it is wise to force
>> the whole system to be underscore-selector compatible
>> because three or so classes (just an example) need them.
>> Especially, these three classes never know what setting
>> they are loaded into. Perhaps there is some very old code
>> that chokes on underscores, so why enable them globally when
>> it is not needed globally. I'd even opt for the preference
>> #allowUnderscore* to be implemented on Object, so this is only
>> virtually global.
>
> What would it mean that e.g. a SmallInteger returns true to #allowUnderscoreSelectors?
>

yes, why not?

>>  Make as least things global as possible.
>
> Pharo took the easier way: no underscore assignments. So underscores are allowed everywhere else. AFAIK they didn't face any problem with this approach. We have much better backwards compatibility even with the system wide preferences.
>
>>
>> You said:
>>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>>
>> I would take that as a reason to fix monticello.
>> It is the same problem for #parserClass #compilerClass
>
> Similar case, but IIRC class side methods are loaded before instance side ones, so these don't cause any trouble.

oO I thought #allowUnderscoreSelectors was Class-side, too…, however,
how to specify to use underscores on the class side?

>
>> etc.pp. You don't want to remove that support, too, do you?
>
> AFAIK noone proved that per-class scoping is possible to do at all.

Concerning what?
I'm using per-class scoping for some projects.
(that is, for parser, compiler and shout-parser)
Ometa also does.

> How would you fix the case, when a class has underscores in it's name? You can't load the class side selector, before loading the class itself, can you?
> How would you fix class side methods? You can't add methods to the metaclass.

Hmm, a loadable superclass that does this kind of "configuration" ?
>
> Another flaw with the per-class scoping is that not only the implementors, but the senders/users of such methods/variables/classes has to enable underscores in selectors.

depends.
If you think about backwards-compatibility, this is no issue, the
existing code should not interfere with the new, underscory one.
If you have newer code that wants to use the underscory code,
well, then you probably have to enable underscores for that particular case, but
I don't think that this is especially an issue.

So Long,
        -Tobias
Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Levente Uzonyi-2
On Tue, 3 May 2011, Tobias Pape wrote:

>
> Am 2011-05-02 um 20:28 schrieb Levente Uzonyi:
>>
>> What would it mean that e.g. a SmallInteger returns true to #allowUnderscoreSelectors?
>>
>
> yes, why not?

I guess you misread my question.

>
>>>  Make as least things global as possible.
>>
>> Pharo took the easier way: no underscore assignments. So underscores are allowed everywhere else. AFAIK they didn't face any problem with this approach. We have much better backwards compatibility even with the system wide preferences.
>>
>>>
>>> You said:
>>>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>>>
>>> I would take that as a reason to fix monticello.
>>> It is the same problem for #parserClass #compilerClass
>>
>> Similar case, but IIRC class side methods are loaded before instance side ones, so these don't cause any trouble.
>
> oO I thought #allowUnderscoreSelectors was Class-side, too?, however,
> how to specify to use underscores on the class side?

Currently there's no way to specify that. The difference between
#allowUnderscoreSelectors and #parserClass is that you don't want to
change the parser of the class side, but you may want to use underscores
in class side methods (or even class names).

>
>>
>>> etc.pp. You don't want to remove that support, too, do you?
>>
>> AFAIK noone proved that per-class scoping is possible to do at all.
>
> Concerning what?
> I'm using per-class scoping for some projects.
> (that is, for parser, compiler and shout-parser)
> Ometa also does.

See above why this problem is different.

>
>> How would you fix the case, when a class has underscores in it's name? You can't load the class side selector, before loading the class itself, can you?
>> How would you fix class side methods? You can't add methods to the metaclass.
>
> Hmm, a loadable superclass that does this kind of "configuration" ?

How does that solve the issue with class names and class side methods?

>>
>> Another flaw with the per-class scoping is that not only the implementors, but the senders/users of such methods/variables/classes has to enable underscores in selectors.
>
> depends.
> If you think about backwards-compatibility, this is no issue, the
> existing code should not interfere with the new, underscory one.
> If you have newer code that wants to use the underscory code,
> well, then you probably have to enable underscores for that particular case, but
> I don't think that this is especially an issue.

Did you try to use a package that has underscores in selectors or class
names?


Levente

>
> So Long,
> -Tobias
>

Reply | Threaded
Open this post in threaded view
|

Re: Fixing support for selectors with underscores

Tobias Pape

Am 2011-05-03 um 15:09 schrieb Levente Uzonyi:

> On Tue, 3 May 2011, Tobias Pape wrote:
>
>>
>> Am 2011-05-02 um 20:28 schrieb Levente Uzonyi:
>>>
>>> What would it mean that e.g. a SmallInteger returns true to #allowUnderscoreSelectors?
>>>
>>
>> yes, why not?
>
> I guess you misread my question.

Oh, sure.
It would mean that every class that descends from SmallInteger
can use underscore selectors.

>
>>
>>>> Make as least things global as possible.
>>>
>>> Pharo took the easier way: no underscore assignments. So underscores are allowed everywhere else. AFAIK they didn't face any problem with this approach. We have much better backwards compatibility even with the system wide preferences.
>>>
>>>>
>>>> You said:
>>>>> - It doesn't work with code loading tools (e.g. Monticello), because there's no guarantee, that #allowUnderscoreSelectors will be loaded before the methods using underscores that way.
>>>>
>>>> I would take that as a reason to fix monticello.
>>>> It is the same problem for #parserClass #compilerClass
>>>
>>> Similar case, but IIRC class side methods are loaded before instance side ones, so these don't cause any trouble.
>>
>> oO I thought #allowUnderscoreSelectors was Class-side, too?, however,
>> how to specify to use underscores on the class side?
>
> Currently there's no way to specify that. The difference between #allowUnderscoreSelectors and #parserClass is that you don't want to change the parser of the class side, but you may want to use underscores in class side methods (or even class names).
>

Yes.

>>
>>>
>>>> etc.pp. You don't want to remove that support, too, do you?
>>>
>>> AFAIK noone proved that per-class scoping is possible to do at all.
>>
>> Concerning what?
>> I'm using per-class scoping for some projects.
>> (that is, for parser, compiler and shout-parser)
>> Ometa also does.
>
> See above why this problem is different.
>
>>
>>> How would you fix the case, when a class has underscores in it's name? You can't load the class side selector, before loading the class itself, can you?
>>> How would you fix class side methods? You can't add methods to the metaclass.
>>
>> Hmm, a loadable superclass that does this kind of "configuration" ?
>
> How does that solve the issue with class names and class side methods?

Well if this class is loaded first, we can ask it for the config
and apply it to the subclasses.

>
>>>
>>> Another flaw with the per-class scoping is that not only the implementors, but the senders/users of such methods/variables/classes has to enable underscores in selectors.
>>
>> depends.
>> If you think about backwards-compatibility, this is no issue, the
>> existing code should not interfere with the new, underscory one.
>> If you have newer code that wants to use the underscory code,
>> well, then you probably have to enable underscores for that particular case, but
>> I don't think that this is especially an issue.
>
> Did you try to use a package that has underscores in selectors or class names?

I have to admit, no, not yet.
But I want to do some gemstone-things, where underscore selectors
are more common, so I will hit these issues :)


So Long,
        -Tobias