I'm being told that Squeak doesn't like class names with underscores. I'm using those for ExternalStructures to keep their names in sync with their C-side counterparts and I didn't notice a problem in Pharo. Is that something that is a problem for Squeak ? If so is there some sort of convention on how to convert such names when writing external bindings with FFI ?
Thanks, Martin |
On 21 January 2011 16:12, <[hidden email]> wrote:
> I'm being told that Squeak doesn't like class names with underscores. I'm using those for ExternalStructures to keep their names in sync with their C-side counterparts and I didn't notice a problem in Pharo. Is that something that is a problem for Squeak ? If so is there some sort of convention on how to convert such names when writing external bindings with FFI ? > if you set 'use underscore for selectors' and disable 'underscore for assignments' in preferences then class names should work as well, AFAIK. > Thanks, > > Martin > > -- Best regards, Igor Stasenko AKA sig. |
In reply to this post by mkobetic
"Igor Stasenko"<[hidden email]> wrote:
> if you set 'use underscore for selectors' and disable 'underscore for > assignments' in preferences then class names should work as well, > AFAIK. But if that's not how most people will run Squeak, then that's not a reasonable option for me. What are the default settings and are they likely to ever change ? |
In reply to this post by Igor Stasenko
On Fri, 21 Jan 2011, Igor Stasenko wrote:
> On 21 January 2011 16:12, <[hidden email]> wrote: >> I'm being told that Squeak doesn't like class names with underscores. I'm using those for ExternalStructures to keep their names in sync with their C-side counterparts and I didn't notice a problem in Pharo. Is that something that is a problem for Squeak ? If so is there some sort of convention on how to convert such names when writing external bindings with FFI ? >> > > if you set 'use underscore for selectors' and disable 'underscore for > assignments' in preferences then class names should work as well, > AFAIK. In Squeak you can use both at the same time. The exact names are "Allow underscore assignments" and "Allow underscore selectors". Levente > >> Thanks, >> >> Martin >> >> > > > > -- > Best regards, > Igor Stasenko AKA sig. > > |
In reply to this post by mkobetic
On Fri, 21 Jan 2011, [hidden email] wrote:
> "Igor Stasenko"<[hidden email]> wrote: >> if you set 'use underscore for selectors' and disable 'underscore for >> assignments' in preferences then class names should work as well, >> AFAIK. > > But if that's not how most people will run Squeak, then that's not a reasonable option for me. What are the default settings and are they likely to ever change ? The default is: underscore assignments are allowed, underscore selectors are not. This is fully backwards compatible. You can enable underscore selectors for your classes (both senders and implementors) in Squeak by implementing the class side method #allowUnderscoreSelectors as ^true. Browsing the source code has some problems due to a bug (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. Levente > > |
On 21 January 2011 17:39, Levente Uzonyi <[hidden email]> wrote:
> On Fri, 21 Jan 2011, [hidden email] wrote: > >> "Igor Stasenko"<[hidden email]> wrote: >>> >>> if you set 'use underscore for selectors' and disable 'underscore for >>> assignments' in preferences then class names should work as well, >>> AFAIK. >> >> But if that's not how most people will run Squeak, then that's not a >> reasonable option for me. What are the default settings and are they likely >> to ever change ? > > The default is: underscore assignments are allowed, underscore selectors are > not. This is fully backwards compatible. > You can enable underscore selectors for your classes (both senders and > implementors) in Squeak by implementing the class side method > #allowUnderscoreSelectors as ^true. > Browsing the source code has some problems due to a bug > (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. > You can't safely recompile source at will, like: Compiler recompileAll because parts of code could be filed in using one setting, and other code loaded when setting is different. So, you have to live with worst possible solution between: - having cake, but can't eat it - not having cake, but attempt to eat it :) > > Levente > -- Best regards, Igor Stasenko AKA sig. |
In reply to this post by mkobetic
"Levente Uzonyi"<[hidden email]> wrote:
> The default is: underscore assignments are allowed, underscore selectors > are not. This is fully backwards compatible. > You can enable underscore selectors for your classes (both senders and > implementors) in Squeak by implementing the class side method > #allowUnderscoreSelectors as ^true. > Browsing the source code has some problems due to a bug > (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. OK, just to make sure, since this all talks about selectors. It is OK to have a class with the *class name* with underscores if I add #allowUnderscoreSelectors ^true to it ? Thanks for your help, Martin |
In reply to this post by Igor Stasenko
On Fri, 21 Jan 2011, Igor Stasenko wrote:
> On 21 January 2011 17:39, Levente Uzonyi <[hidden email]> wrote: >> On Fri, 21 Jan 2011, [hidden email] wrote: >> >>> "Igor Stasenko"<[hidden email]> wrote: >>>> >>>> if you set 'use underscore for selectors' and disable 'underscore for >>>> assignments' in preferences then class names should work as well, >>>> AFAIK. >>> >>> But if that's not how most people will run Squeak, then that's not a >>> reasonable option for me. What are the default settings and are they likely >>> to ever change ? >> >> The default is: underscore assignments are allowed, underscore selectors are >> not. This is fully backwards compatible. >> You can enable underscore selectors for your classes (both senders and >> implementors) in Squeak by implementing the class side method >> #allowUnderscoreSelectors as ^true. >> Browsing the source code has some problems due to a bug >> (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. >> > No only that. > > You can't safely recompile source at will, like: > Compiler recompileAll > because parts of code could be filed in using one setting, and other > code loaded when setting is different. > So, you have to live with worst possible solution between: > - having cake, but can't eat it > - not having cake, but attempt to eat it > :) with the preference turned on or off. If you load code that requires the preference to be turned on _and_ you load code at some other time that requires it to be off, then it will be problem. But it's very easy to solve it, just remove the ambiguity of your methods. (Only ambiguous underscore assignments cause problems.) Levente > >> >> Levente >> > > > > > -- > Best regards, > Igor Stasenko AKA sig. > |
In reply to this post by mkobetic
On Fri, 21 Jan 2011, [hidden email] wrote:
> "Levente Uzonyi"<[hidden email]> wrote: >> The default is: underscore assignments are allowed, underscore selectors >> are not. This is fully backwards compatible. >> You can enable underscore selectors for your classes (both senders and >> implementors) in Squeak by implementing the class side method >> #allowUnderscoreSelectors as ^true. >> Browsing the source code has some problems due to a bug >> (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. > > OK, just to make sure, since this all talks about selectors. It is OK to have a class with the *class name* with underscores if I add #allowUnderscoreSelectors ^true to it ? You can create classes with underscores in their name, but if you want to reference such class from another class, then the other class has to implement #allowUnderscoreSelectors as returning true, or the preference has to be turned on. The class side method doesn't affect the Metaclass, so if you want to reference a class or send a method with an underscore in it's name from a class side method, then you have to turn the preference on. Levente > > Thanks for your help, > > Martin > |
In reply to this post by Igor Stasenko
On 1/21/2011 5:50 PM, Igor Stasenko wrote:
> On 21 January 2011 17:39, Levente Uzonyi<[hidden email]> wrote: >> On Fri, 21 Jan 2011, [hidden email] wrote: >> >>> "Igor Stasenko"<[hidden email]> wrote: >>>> >>>> if you set 'use underscore for selectors' and disable 'underscore for >>>> assignments' in preferences then class names should work as well, >>>> AFAIK. >>> >>> But if that's not how most people will run Squeak, then that's not a >>> reasonable option for me. What are the default settings and are they likely >>> to ever change ? >> >> The default is: underscore assignments are allowed, underscore selectors are >> not. This is fully backwards compatible. >> You can enable underscore selectors for your classes (both senders and >> implementors) in Squeak by implementing the class side method >> #allowUnderscoreSelectors as ^true. >> Browsing the source code has some problems due to a bug >> (http://bugs.squeak.org/view.php?id=7547 ), but the code will work. >> > No only that. > > You can't safely recompile source at will, like: > Compiler recompileAll > because parts of code could be filed in using one setting, and other > code loaded when setting is different. > So, you have to live with worst possible solution between: > - having cake, but can't eat it > - not having cake, but attempt to eat it > :) The global preference is intended to make fileIns work for the first time. To keep your underscore preferences consistent within your code see Behavior>>allowUnderscoreSelectors and Behavior>>allowUnderscoreAssignments. It's not perfect since it should be on a package-basis but it's better than nothing. Cheers, - Andreas |
Free forum by Nabble | Edit this page |