You cannot easily redefine these selectors:

#(#caseOf: #to:do: #ifNotNil: #ifNil:ifNotNil: #whileTrue: #ifNotNil:ifNil:
#ifFalse: #timesRepeat: #whileTrue #caseOf:otherwise: #whileFalse: #ifNil:
#to:by:do: #ifTrue: #ifFalse:ifTrue: #or: #whileFalse #ifTrue:ifFalse:
#and:)

You can redefine those selectors but depending on the send site, the
redefined method is used or not.

One trick is to have the send site in a method / class with compilation
options disabling the inlining of the selectors you want.

Another trick is to use a pattern different slightly that the optimized
pattern, for example, I believe that Marcus changed #and: so:
a and: [ b ] -> and: is optimized at compile time, send site won't use
overridden method.
a and: [ :x | b ] -> and: is not optimized at compile time, send site will
use overridden method.

Maybe it works with #or: too.


2015-04-30 21:47 GMT+02:00 stepharo <[email protected]>:

> In nautilus I get an error MNU: RBBlockNode>>method
> When I select several groups and select merge
>
>
> mergeGroups: aCollection
>
>     aCollection
>         ifNotEmpty: [:groups || group |
>             group := groups reduce: [:a :b | a or: [b]].
> ^^^^^^^^^^^^
>
>                                                 a is a dynamicClassGroup
> and its superclass defines or:
>
>             groups do: [:gp |
>                 gp removable
>                     ifTrue: [self groupsManager removeAGroupSilently: gp]].
>                 ^ group].
>     ^ nil
>
> RBBlockNode(Object)>>doesNotUnderstand: #method
> RBBlockNode>>sourceNodeForPC:
> DynamicClassGroup(Object)>>mustBeBooleanInMagic:
> DynamicClassGroup(Object)>>mustBeBoolean
> [ :a :b | a or: [ b ] ] in [ :groups |
> | group |
> group := groups reduce: [ :a :b | a or: [ b ] ].
> groups
>     do: [ :gp |
>         gp removable
>             ifTrue: [ self groupsManager removeAGroupSilently: gp ] ].
> ^ group ] in PackageTreeNautilusUI(AbstractTool)>>mergeGroups: in Block: [
> :a :b | a or: [ b ] ]
> [ :index |
> arguments
>     replaceFrom: 2
>         to: arguments size
>         with: self
>         startingAt: index;
>     at: 1 put: (aBlock valueWithArguments: arguments) ] in
> Array(SequenceableCollection)>>reduceLeft: in Block: [ :index | ...
> SmallInteger(Number)>>to:by:do:
> Array(SequenceableCollection)>>reduceLeft:
> Array(SequenceableCollection)>>reduce:
> [ :groups |
> | group |
> group := groups reduce: [ :a :b | a or: [ b ] ].
> groups
>     do: [ :gp |
>         gp removable
>             ifTrue: [ self groupsManager removeAGroupSilently: gp ] ].
> ^ group ] in PackageTreeNautilusUI(AbstractTool)>>mergeGroups: in Block: [
> :groups | ...
> BlockClosure>>cull:
> Array(Collection)>>ifNotEmpty:
> PackageTreeNautilusUI(AbstractTool)>>mergeGroups:
> PackageTreeNautilusUI(AbstractNautilusUI)>>mergeGroups
> [ target mergeGroups ] in AbstractNautilusUI class>>groupsMenu: in Block:
> [ target mergeGroups ]
> BlockClosure>>cull:
> [
> | selArgCount |
> "show cursor in case item opens a new MVC window"
> (selArgCount := selector numArgs) = 0
>     ifTrue: [ target perform: selector ]
>     ifFalse: [
>         selArgCount = arguments size
>             ifTrue: [ target perform: selector withArguments: arguments ]
>             ifFalse: [ target perform: selector withArguments: (arguments
> copyWith: evt) ] ].
> self changed ] in ToggleMenuItemMorph(MenuItemMorph)>>invokeWithEvent: in
> Block: [ ...
> BlockClosure>>ensure:
> CursorWithMask(Cursor)>>showWhile:
> ToggleMenuItemMorph(MenuItemMorph)>>invokeWithEvent:
> ToggleMenuItemMorph(MenuItemMorph)>>mouseUp:
> ToggleMenuItemMorph(MenuItemMorph)>>handleMouseUp:
> MouseButtonEvent>>sentTo:
> ToggleMenuItemMorph(Morph)>>handleEvent:
> MorphicEventDispatcher>>dispatchDefault:with:
> MorphicEventDispatcher>>handleMouseUp:
> MouseButtonEvent>>sentTo:
> [ ^ anEvent sentTo: self ] in MorphicEventDispatcher>>dispatchEvent:with:
> in Block: [ ^ anEvent sentTo: self ]
> BlockClosure>>ensure:
> MorphicEventDispatcher>>dispatchEvent:with:
>
>
>

Reply via email to