It is forbidden by contract :) 100%
I like that
What would be great is that we can create QA rules dedicated to Bloc and
Brick.
On Jan 31, 2016 9:31 PM, "stepharo" <[email protected]
<mailto:[email protected]>> wrote:
I really hope that Bloc will forbid such systematic submorphs use
because it leads to code like that.
Stef
submorphNamed: aName
^ self submorphNamed: aName ifNone: [nil]
submorphNamed: aName ifNone: aBlock
"Find the first submorph with this name, or a button with an
action selector of that name"
self submorphs do:
[:button | | sub args |
(button respondsTo: #actionSelector)
ifTrue: [button actionSelector == aName ifTrue:
[^button]].
((button respondsTo: #arguments) and: [(args := button
arguments) notNil])
ifTrue: [(args at: 2 ifAbsent: [nil]) == aName
ifTrue: [^button]].
(button isAlignmentMorph)
ifTrue: [(sub := button submorphNamed: aName
ifNone: [nil]) ifNotNil: [^sub]]].
^aBlock value