[squeak-dev] I was surprised

Bob Arning arning315 at comcast.net
Tue Jan 3 18:37:48 UTC 2017


I rarely use | myself, but I was translating some javascript and trying 
not to misread it and failed to think about the parens in that case. 
When the code was not working correctly, I was scratching my head until 
I saw my mistake, but my surprise was that it hadn't blown up the first 
time I ran it.


On 1/3/17 1:11 PM, Levente Uzonyi wrote:
> If you use #or: instead of #| (which should always be the case IMO, 
> because you hardly ever want non-short-circuit boolean evaluation), 
> then you'll probably not forget the parentheses:
>
>     'a' = 'a' or: [ 'a' = 'b' ] "==> true"
>
> Or even if you do forget them, you'll still get the expected result
> because of the higher precedence:
>
>     'a' = 'a' or: 'a' = 'b' "==> true"
>
> Levente
>
> On Tue, 3 Jan 2017, Bob Arning wrote:
>
>>
>> Or by people making a mistake
>>
>> 'a' = 'a' | 'a' = 'b' ==> false
>>
>>
>> On 1/3/17 10:06 AM, Bert Freudenberg wrote:
>>       On Tue, Jan 3, 2017 at 1:17 PM, Bob Arning 
>> <arning315 at comcast.net> wrote:
>>
>>             This has been this way for aeons, but it surprised me:
>>
>>             false | 'hello'  ==> 'hello'
>>
>>             Does anything actually depend on this being this way?
>>
>> Unlikely. It's only ever used with booleans.
>>
>> - Bert -
>>
>>
>>
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170103/7e362b8c/attachment.html>


More information about the Squeak-dev mailing list