[squeak-dev] Re: code formatting

Travis Griggs travisgriggs at gmail.com
Tue Jun 29 07:49:31 UTC 2010


On Jun 28, 2010, at 8:06 AM, Levente Uzonyi wrote:

> 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?

VisualWorks does so. I use the pattern frequently.

--
Travis Griggs
Objologist
Light travels faster than sound. This is why some people appear bright  
until you hear them speak...







More information about the Squeak-dev mailing list