On Fri, May 1, 2015 at 4:31 AM, Clément Bera <bera.clem...@gmail.com> wrote:
> 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. > > That seems a bit exotic and complicate ongoing maintenance. I hope its use is heavily commented. But a naive question, why not something intention revealing like #myAnd: or #unoptimisedAnd: or #slowAnd: cheers -ben