[squeak-dev] The Inbox: ST80-ct.256.mcz
Das.Linux at gmx.de
Sat Jun 13 14:16:20 UTC 2020
> On 13.06.2020, at 15:46, K K Subbu <kksubbu.ml at gmail.com> wrote:
> On 13/06/20 5:54 pm, Nicolas Cellier wrote:
>> Hi Subbu,
>> the or:/and:
>> are inlined, so there is no block activated, just conditional jump byte codes like ifTrue:/ifFalse:
>> | and & cost a message send. It would be interesting to study how sista inlining deals with it...
> That's a neat trick! Thanks for this tip. Advantage or:!
It simply depends.
#and:/#or: are inherently short-circuit logic. The block context is only evaluated if necessary (see the implementations)
#& / #| are binary sends, and therefore _both_ arguments are always evaluated before the message is sent.
Sometimes you need that, sometimes it is even easier to read.
> I still see 137 senders of | like #contents:notifying: and #methodReference in Browser.
Note that and:/or: were not always inlined, so #|/#& were fair contenders.
Also, I don't think that we now should go hunting for those messages. They're not inherently bad.
> There is also
> this weird expression in Complex>>framePolygon:...
> (i = 1 | true) ifTrue:[
> Regards .. Subbu
More information about the Squeak-dev