[squeak-dev] Block argument syntax
Frank Shearar
frank.shearar at gmail.com
Fri Mar 1 15:05:58 UTC 2013
Hi Ron,
Oh dear. Here I was hoping it was just a Squeak bug, because that
would be easy to fix. You can't define a method "foo : arg" after all;
the : is part of the selector.
I stumbled upon this because I noticed that Haskell's type identifiers
- like "add :: Int -> Int -> Int" are very nearly valid Smalltalk.
It's just the "::" that's not valid because we don't permit :s in
binary selectors.
frank
On 1 March 2013 14:48, Ron Teitelbaum <ron at usmedrec.com> wrote:
> Hi Frank,
>
> I know this is true for a number of Smalltalk implementations. I found it
> very surprising also. Someone I worked with always formatted their code
> this way. He said it made it easier to double click and highlight the
> variable. I wasn't sure that was enough reason to do it but he did.
>
> Ron
>
>> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
>> bounces at lists.squeakfoundation.org] On Behalf Of Frank Shearar
>>
>> I was rather surprised to learn that the following is valid syntax:
>>
>> [ : x | x + 1]
>>
>> (Note the space before the argument name.)
>>
>> In fact, this is too:
>>
>> [ : "This is a really long comment in a very, very strange place.
>> It makes it very hard to see that the : before this comment turns the
> token after
>> this comment into a block argument." x | x + 1]
>>
>> Is that intentional? Does ANSI Smalltalk define it?
>>
>> frank
>>
>
>
>
More information about the Squeak-dev
mailing list
|