[squeak-dev] Selectors with underscores

Igor Stasenko siguctua at gmail.com
Thu Mar 11 21:02:49 UTC 2010


On 11 March 2010 22:35, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> 2010/3/11 Igor Stasenko <siguctua at gmail.com>:
>> On 11 March 2010 16:47, Ian Trudel <ian.trudel at gmail.com> wrote:
>>> 2010/3/11 Torsten Bergmann <astares at gmx.de>:
>>>> 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?
>>>
>>> No, this is *not* something I'd like to have in Squeak. It's a
>>> potential disaster in the long run where either we will be forced to
>>> standardize code in some way or live with a basic image/trunk/etc and
>>> very weird variable names mixing camel_CameANd_whAtnot beyond the
>>> usage of Glorp.
>>>
>>
>> I don't see any disaster with it. Take another languages, does a
>> presence of underscore in names makes them
>> more beatiful/horrible above anything else? I don't think so.
>>
>
> To my understanding, there is no need of _ in selectors, BUT for
> hooking external procedures.
> It's painful to have to remember two different selectors when you
> heaviily rely on FFI (OpenGL is a good example indeed).
>

First, i think we should answer to a simple question: why many other
computer languages allow underscores in their syntax as a
valid character for identifiers.
As to me, the answer is obvious: in natural languages we using space
to separate two words, and since parsers can't cope (or can, but its
highly impractical) with identifiers which having spaces:

my variable := foo.

an underscore is a good compromise between natural language and
computer language to separate two words,
while treat it as a single identifier:

my_variable := foo.

I came to smalltalk not long ago, and having over 15+ years of
programming experience.
I am always used underscores in this way, and never (or occasionally) like this:

_abdomination := foo.


Smalltalk spirit is a language which designed to remove unnecessary
barriers between humand and computer - easy to learn and easy to
express yourself, without need to be a highly educated
genius who can translate a natural human language to a cryptic sequece
of instructions which computer can understand.
And allowing underscores in identifiers, as to me, is highly coherent
with that spirit, because it this makes us easier to express
ourselves.

> Nicolas
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list