The Inbox: Morphic-ct.1632.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Morphic-ct.1632.mcz

commits-2
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1632.mcz

==================== Summary ====================

Name: Morphic-ct.1632
Author: ct
Time: 29 February 2020, 11:29:22.475896 am
UUID: 2d941b38-6604-cb43-bfbb-b7751aa2d55c
Ancestors: Morphic-mt.1631

Proposal: In Morph>>#balloonText, also try to invoke balloonSelector on model.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
  ----- Method: Morph>>balloonText (in category 'accessing') -----
  balloonText
+ "Answer balloon help text or nil, if no help is available."
+ "NB: subclasses may override such that they programatically construct the text, for economy's sake, such as model phrases in a Viewer."
- "Answer balloon help text or nil, if no help is available.  
- NB: subclasses may override such that they programatically  
- construct the text, for economy's sake, such as model phrases in
- a Viewer"
 
+ | balloonSelector |
+ extension ifNil: [^ nil].
- | result |
- extension ifNil: [^nil].
 
  extension balloonText
+ ifNotNil: [:balloonText | ^ balloonText].
+ balloonSelector := extension balloonTextSelector
+ ifNil: [^ nil].
+ (ScriptingSystem helpStringOrNilFor: balloonSelector)
+ ifNotNil: [:result | ^ result].
+ balloonSelector == #methodComment
+ ifTrue: [^ self methodCommentAsBalloonHelp].
+ balloonSelector isUnary
+ ifTrue: [
+ (self respondsTo: balloonSelector)
+ ifTrue: [^ self perform: balloonSelector].
+ (self model respondsTo: balloonSelector)
+ ifTrue: [^ self model perform: balloonSelector]].
+ ^ nil!
- ifNotNil: [:balloonText | result := balloonText]
- ifNil: [extension balloonTextSelector
- ifNotNil: [:balloonSelector |
- result := ScriptingSystem helpStringOrNilFor: balloonSelector.
- (result isNil and: [balloonSelector == #methodComment])
- ifTrue: [result := self methodCommentAsBalloonHelp].
- ((result isNil and: [balloonSelector numArgs = 0])
- and: [self respondsTo: balloonSelector])
- ifTrue: [result := self perform: balloonSelector]]].
- ^ result!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1632.mcz

marcel.taeumel
Hi Christoph.

Please note that you changed the overall style of the method from single to multiple returns. You should mention that in your comment message.

Btw: Do you know about Object >> #perform:orSendTo:? :-)

Best,
Marcel

Am 29.02.2020 11:29:45 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1632.mcz

==================== Summary ====================

Name: Morphic-ct.1632
Author: ct
Time: 29 February 2020, 11:29:22.475896 am
UUID: 2d941b38-6604-cb43-bfbb-b7751aa2d55c
Ancestors: Morphic-mt.1631

Proposal: In Morph>>#balloonText, also try to invoke balloonSelector on model.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
----- Method: Morph>>balloonText (in category 'accessing') -----
balloonText
+ "Answer balloon help text or nil, if no help is available."
+ "NB: subclasses may override such that they programatically construct the text, for economy's sake, such as model phrases in a Viewer."
- "Answer balloon help text or nil, if no help is available.
- NB: subclasses may override such that they programatically
- construct the text, for economy's sake, such as model phrases in
- a Viewer"

+ | balloonSelector |
+ extension ifNil: [^ nil].
- | result |
- extension ifNil: [^nil].

extension balloonText
+ ifNotNil: [:balloonText | ^ balloonText].
+ balloonSelector := extension balloonTextSelector
+ ifNil: [^ nil].
+ (ScriptingSystem helpStringOrNilFor: balloonSelector)
+ ifNotNil: [:result | ^ result].
+ balloonSelector == #methodComment
+ ifTrue: [^ self methodCommentAsBalloonHelp].
+ balloonSelector isUnary
+ ifTrue: [
+ (self respondsTo: balloonSelector)
+ ifTrue: [^ self perform: balloonSelector].
+ (self model respondsTo: balloonSelector)
+ ifTrue: [^ self model perform: balloonSelector]].
+ ^ nil!
- ifNotNil: [:balloonText | result := balloonText]
- ifNil: [extension balloonTextSelector
- ifNotNil: [:balloonSelector |
- result := ScriptingSystem helpStringOrNilFor: balloonSelector.
- (result isNil and: [balloonSelector == #methodComment])
- ifTrue: [result := self methodCommentAsBalloonHelp].
- ((result isNil and: [balloonSelector numArgs = 0])
- and: [self respondsTo: balloonSelector])
- ifTrue: [result := self perform: balloonSelector]]].
- ^ result!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Morphic-ct.1632.mcz

Christoph Thiede

Hi Marcel, thanks for the review!


Please note that you changed the overall style of the method from single to multiple returns.

Do you mean this impedes the readability? It was an attempt to apply the Guard Clause.

Btw: Do you know about Object >> #perform:orSendTo:? :-)

Where would you use that in this method? :-)

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 2. März 2020 10:39:42
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: Morphic-ct.1632.mcz
 
Hi Christoph.

Please note that you changed the overall style of the method from single to multiple returns. You should mention that in your comment message.

Btw: Do you know about Object >> #perform:orSendTo:? :-)

Best,
Marcel

Am 29.02.2020 11:29:45 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1632.mcz

==================== Summary ====================

Name: Morphic-ct.1632
Author: ct
Time: 29 February 2020, 11:29:22.475896 am
UUID: 2d941b38-6604-cb43-bfbb-b7751aa2d55c
Ancestors: Morphic-mt.1631

Proposal: In Morph>>#balloonText, also try to invoke balloonSelector on model.

=============== Diff against Morphic-mt.1631 ===============

Item was changed:
----- Method: Morph>>balloonText (in category 'accessing') -----
balloonText
+ "Answer balloon help text or nil, if no help is available."
+ "NB: subclasses may override such that they programatically construct the text, for economy's sake, such as model phrases in a Viewer."
- "Answer balloon help text or nil, if no help is available.
- NB: subclasses may override such that they programatically
- construct the text, for economy's sake, such as model phrases in
- a Viewer"

+ | balloonSelector |
+ extension ifNil: [^ nil].
- | result |
- extension ifNil: [^nil].

extension balloonText
+ ifNotNil: [:balloonText | ^ balloonText].
+ balloonSelector := extension balloonTextSelector
+ ifNil: [^ nil].
+ (ScriptingSystem helpStringOrNilFor: balloonSelector)
+ ifNotNil: [:result | ^ result].
+ balloonSelector == #methodComment
+ ifTrue: [^ self methodCommentAsBalloonHelp].
+ balloonSelector isUnary
+ ifTrue: [
+ (self respondsTo: balloonSelector)
+ ifTrue: [^ self perform: balloonSelector].
+ (self model respondsTo: balloonSelector)
+ ifTrue: [^ self model perform: balloonSelector]].
+ ^ nil!
- ifNotNil: [:balloonText | result := balloonText]
- ifNil: [extension balloonTextSelector
- ifNotNil: [:balloonSelector |
- result := ScriptingSystem helpStringOrNilFor: balloonSelector.
- (result isNil and: [balloonSelector == #methodComment])
- ifTrue: [result := self methodCommentAsBalloonHelp].
- ((result isNil and: [balloonSelector numArgs = 0])
- and: [self respondsTo: balloonSelector])
- ifTrue: [result := self perform: balloonSelector]]].
- ^ result!




Carpe Squeak!