Christoph Thiede uploaded a new version of ST80 to project The Inbox:
http://source.squeak.org/inbox/ST80-ct.256.mcz ==================== Summary ==================== Name: ST80-ct.256 Author: ct Time: 12 June 2020, 3:47:07.291483 pm UUID: 43915256-7d01-d045-a49f-2c87552170e2 Ancestors: ST80-mt.255 Fix Transcript in MVC projects if preference 'Force transcript updates to screen' is disabled. Thanks to Marcel (mt) for the hint! Second try: Use conservative syntax. Replaces ST80-ct.255 wich can be treated. =============== Diff against ST80-mt.255 =============== Item was changed: ----- Method: PluggableTextView>>update: (in category 'updating') ----- update: aSymbol "Refer to the comment in View|update:. Do nothing if the given symbol does not match any action. " aSymbol == #wantToChange ifTrue: [self canDiscardEdits ifFalse: [self promptForCancel]. ^ self]. aSymbol == #flash ifTrue: [^ controller flash]. aSymbol == getTextSelector ifTrue: [^ self updateDisplayContents]. aSymbol == getSelectionSelector ifTrue: [^ self setSelection: self getSelection]. aSymbol == #clearUserEdits ifTrue: [^ self hasUnacceptedEdits: false]. (aSymbol == #autoSelect and: [getSelectionSelector ~~ nil]) ifTrue: [ParagraphEditor abandonChangeText. "no replacement!!" ^ controller setSearch: model autoSelectString; againOrSame: true]. aSymbol == #appendEntry ifTrue: [^ controller doOccluded: [controller appendEntry]]. + aSymbol == #appendEntryLater ifTrue: + [^ controller doOccluded: [controller appendEntry]]. aSymbol == #clearText ifTrue: [^ controller doOccluded: [controller changeText: Text new]]. aSymbol == #bs ifTrue: [^ controller doOccluded: [controller bsText]]. aSymbol == #codeChangedElsewhere ifTrue: [^ self hasEditingConflicts: true]. aSymbol == #saveContents ifTrue: [^self controller saveContentsInFile]. aSymbol == #close ifTrue: [^self topView controller closeAndUnscheduleNoTerminate]. aSymbol == #acceptChanges ifTrue: [^ self controller accept]. aSymbol == #revertChanges ifTrue: [^ self controller cancel].! |
On 12/06/20 1:47 pm, [hidden email] wrote:
> aSymbol == #appendEntry ifTrue: > [^ controller doOccluded: [controller appendEntry]]. > + aSymbol == #appendEntryLater ifTrue: > + [^ controller doOccluded: [controller appendEntry]]. How about (aSymbol == #appendEntry) | (aSymbol == #appendEntryLater) ifTrue: [^ controller doOccluded: [controller appendEntry]]. Regards .. Subbu |
Marcel explicitly asked for duplicating these lines. However, one single condition would not be bad either, but why would you use #| instead of #or: here? Is this just in order to save one pair of brackets? ;-)
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von K K Subbu <[hidden email]>
Gesendet: Freitag, 12. Juni 2020 18:45:58 An: [hidden email] Betreff: Re: [squeak-dev] The Inbox: ST80-ct.256.mcz On 12/06/20 1:47 pm, [hidden email] wrote:
> aSymbol == #appendEntry ifTrue: > [^ controller doOccluded: [controller appendEntry]]. > + aSymbol == #appendEntryLater ifTrue: > + [^ controller doOccluded: [controller appendEntry]]. How about (aSymbol == #appendEntry) | (aSymbol == #appendEntryLater) ifTrue: [^ controller doOccluded: [controller appendEntry]]. Regards .. Subbu
Carpe Squeak!
|
On 12/06/20 11:18 pm, Thiede, Christoph wrote:
> Marcel explicitly asked for duplicating these lines. However, one > single condition would not be bad either, but why would you use #| > instead of #or: here? Is this just in order to save one pair of > brackets? ;-) It is an simple boolean expression that can be evaluated in a single sequence of bytecodes. If the first part of the or: is false, then a block has to be activated and evaluated for the result. If the block involves significant computation then the overhead may not matter much. For simple expressions, it is an overkill. Regards .. Subbu |
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... Le sam. 13 juin 2020 à 13:58, K K Subbu <[hidden email]> a écrit : On 12/06/20 11:18 pm, Thiede, Christoph 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:! I still see 137 senders of | like #contents:notifying: and #methodReference in Browser. There is also this weird expression in Complex>>framePolygon:... ----- (i = 1 | true) ifTrue:[ ----- Regards .. Subbu |
> On 13.06.2020, at 15:46, K K Subbu <[hidden email]> 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. -t > There is also > this weird expression in Complex>>framePolygon:... > ----- > (i = 1 | true) ifTrue:[ > ----- > > Regards .. Subbu > |
In reply to this post by Nicolas Cellier
On Sat, 13 Jun 2020, 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... #| and #& will be slower even with inlining because they are the non-short-circuit variants of #or: and #and:. Levente > > Le sam. 13 juin 2020 à 13:58, K K Subbu <[hidden email]> a écrit : > On 12/06/20 11:18 pm, Thiede, Christoph wrote: > > Marcel explicitly asked for duplicating these lines. However, one > > single condition would not be bad either, but why would you use #| > > instead of #or: here? Is this just in order to save one pair of > > brackets? ;-) > > It is an simple boolean expression that can be evaluated in a single > sequence of bytecodes. > > If the first part of the or: is false, then a block has to be activated > and evaluated for the result. If the block involves significant > computation then the overhead may not matter much. For simple > expressions, it is an overkill. > > Regards .. Subbu > > > |
Free forum by Nabble | Edit this page |