A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-cbc.1164.mcz ==================== Summary ==================== Name: Kernel-cbc.1164 Author: cbc Time: 26 March 2018, 4:24:34.650291 pm UUID: 1db3c61f-3486-5847-bb7b-2e3409818f92 Ancestors: Kernel-cbc.1163 Removed implementation from Boolean>>xor: (made it sublcass responsibility). Chose a better method argument name for #xor: =============== Diff against Kernel-cbc.1163 =============== Item was changed: ----- Method: Boolean>>xor: (in category 'logical operations') ----- + xor: aBooleanOrBlock + "Exclusive OR. Answer true if self is not equivalent to aBooleanOrBlock. + aBooleanOrBlock is either a boolean, or evaluates to a boolean." - xor: aBoolean - "Exclusive OR. Answer true if the receiver is not equivalent to aBoolean." + ^self subclassResponsibility! - ^(self == aBoolean) not! Item was changed: ----- Method: False>>xor: (in category 'logical operations') ----- + xor: aBooleanOrBlock + "aBooleanOrBlock is either a boolean, or an object who's #value returns a boolean (usually a block)." + ^aBooleanOrBlock value ifTrue: [ true ] ifFalse: [ false ]! - xor: aBoolean - "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)." - ^aBoolean value ifTrue: [ true ] ifFalse: [ false ]! Item was changed: ----- Method: True>>xor: (in category 'logical operations') ----- + xor: aBooleanOrBlock + "aBooleanOrBlock is either a boolean, or an object who's #value returns a boolean (usually a block)." + ^aBooleanOrBlock value ifTrue: [ false ] ifFalse: [ true ]! - xor: aBoolean - "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)." - ^aBoolean value ifTrue: [ false ] ifFalse: [ true ]! |
I like the better-named arguments, but may we please keep an abstract
implementation up in Boolean anyway? Besides being documentative (is that a word?), for a semi-controversial change like this, it allows users to easily configure back to standard Smalltalk implementation (non block-supporting) by merely removing subclass selectors. No need to compile new source.. On Mon, Mar 26, 2018 at 6:24 PM, <[hidden email]> wrote: > A new version of Kernel was added to project The Inbox: > http://source.squeak.org/inbox/Kernel-cbc.1164.mcz > > ==================== Summary ==================== > > Name: Kernel-cbc.1164 > Author: cbc > Time: 26 March 2018, 4:24:34.650291 pm > UUID: 1db3c61f-3486-5847-bb7b-2e3409818f92 > Ancestors: Kernel-cbc.1163 > > Removed implementation from Boolean>>xor: (made it sublcass responsibility). > Chose a better method argument name for #xor: > > =============== Diff against Kernel-cbc.1163 =============== > > Item was changed: > ----- Method: Boolean>>xor: (in category 'logical operations') ----- > + xor: aBooleanOrBlock > + "Exclusive OR. Answer true if self is not equivalent to aBooleanOrBlock. > + aBooleanOrBlock is either a boolean, or evaluates to a boolean." > - xor: aBoolean > - "Exclusive OR. Answer true if the receiver is not equivalent to aBoolean." > > + ^self subclassResponsibility! > - ^(self == aBoolean) not! > > Item was changed: > ----- Method: False>>xor: (in category 'logical operations') ----- > + xor: aBooleanOrBlock > + "aBooleanOrBlock is either a boolean, or an object who's #value returns a boolean (usually a block)." > + ^aBooleanOrBlock value ifTrue: [ true ] ifFalse: [ false ]! > - xor: aBoolean > - "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)." > - ^aBoolean value ifTrue: [ true ] ifFalse: [ false ]! > > Item was changed: > ----- Method: True>>xor: (in category 'logical operations') ----- > + xor: aBooleanOrBlock > + "aBooleanOrBlock is either a boolean, or an object who's #value returns a boolean (usually a block)." > + ^aBooleanOrBlock value ifTrue: [ false ] ifFalse: [ true ]! > - xor: aBoolean > - "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)." > - ^aBoolean value ifTrue: [ false ] ifFalse: [ true ]! > > |
Hi All,
On Mon, Mar 26, 2018 at 9:22 PM, Chris Muller <[hidden email]> wrote: I like the better-named arguments, but may we please keep an abstract The problem is that the abstract implementation is wrong. Here it is: xor: aBoolean "Exclusive OR. Answer true if the receiver is not equivalent to aBoolean." ^(self == aBoolean) not a) it accepts non-booleans b) it answers true when given a block I believe what we want is xor: aBooleanOrBlock "Exclusive OR. Answer true if the receiver is not equivalent to aBoolean." ^ aBooleanOrBlock value ifTrue: [self not] ifFalse: [self] I'm happy to commit this if people agree. But personally I prefer the subclassResponsibility. Now, I have some angels dancing somewhere I'd like to check out...
_,,,^..^,,,_ best, Eliot |
Free forum by Nabble | Edit this page |