[squeak-dev] Re: code formatting

Levente Uzonyi leves at elte.hu
Mon Jun 28 15:06:12 UTC 2010


On Mon, 28 Jun 2010, Bert Freudenberg wrote:

> On 28.06.2010, at 16:00, Levente Uzonyi wrote:
>
>> You can exchange the temp for a message send this way:
>>
>> self socket ifNotNil: #closeAndDestroy.
>
> No, you can't.

I see, the compiler doesn't like it. It's a minor bug. But even if that's 
fixed it won't work, because symbols only understand #value: and 
#ifNotNil: sends #valueWithPossibleArgs:.

| message |
message := #squared.
5 ifNotNil: message.

This is another strange case:

| block |
block := [ :a :b | a ].
5 ifNotNil: block. "===> 5"

I wonder if there's code that relies on this feature. If not, then we 
could replace some #valueWithPossibleArgs: sends to #cull:.

Would it make sense to implement #valueWithPossibleArgs: (and friends) and 
#cull: (and friends) for symbols?


Levente

>
> - Bert -
>
>
>
>



More information about the Squeak-dev mailing list