[squeak-dev] Selectors with underscores

Matthew Fulmer tapplek at gmail.com
Thu Mar 11 17:54:47 UTC 2010

On Thu, Mar 11, 2010 at 03:36:43PM +0100, Torsten Bergmann wrote:
> Pharo allows you to use underscores in method selectors.
> This is currently in Pharo 1.1 and not 1.0.
> Does that makes sense to have in Squeak trunk/Cuis too?

I say support it. Cobalt and Croquet have supported this for
years. I have an experimental patch to MC1.5 that converts
underscore assignments to := at load time, if the compiler
raises a SyntaxError about them. How it works:

- Parser throws a syntax error
- MC catches the error
- MC uses the parser to find underscore assignments (and not
  underscores in strings/comments/names) and replace them
- MC retries compiling the method
- If a syntax error is raised again, MC lets it thru and you see
  the Syntax Error dialog box
- If any methods were changed during load, MC tells you about
  them so you can review them and save the package

Note that it's triggered by a SyntaxError, so this will not be
done if the preference is to allow underscore assignments.

Also, it only fixes things the parser things are disallowed
underscore assignments, so it is quite conservative.

I use this to prepare packages for loading into Cobalt (where
underscores assignments are disallowed by default)

Matthew Fulmer (a.k.a. Tapple)

More information about the Squeak-dev mailing list