[squeak-dev] The Trunk: Kernel-nice.628.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 26 19:11:03 UTC 2011


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.628.mcz

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

Name: Kernel-nice.628
Author: nice
Time: 26 September 2011, 9:10:09.363 pm
UUID: 9c77ee63-103f-4577-b987-5ee0f539d582
Ancestors: Kernel-nice.627

Boolean subclasses know better how to behave, so if we delegate ==> , we can implement a branch-less implication. 

Though I wonder if this is really an optimization in case of a JIT VM...
{
[true ==> [1 > 2]] bench.
[false ==> [1 > 2]] bench.
}
#( '6,440,000 per second.' '6,690,000 per second.') "BEFORE"
#( '6,410,000 per second.' '7,030,000 per second.') "AFTER"

=============== Diff against Kernel-nice.627 ===============

Item was added:
+ ----- Method: Boolean>>===> (in category 'logical operations') -----
+ ===> aBlock
+ 	"this is material implication, a ==> b, also known as:
+ 			b if a 
+ 			a implies b
+ 			if a then b
+ 			b is a consequence of a
+ 			a therefore b (but note: 'it is raining therefore it is cloudy' is implication; 'it is autumn therefore the leaves are falling' is equivalence).
+ 		
+ 	Here is the truth table for material implication (view in a monospaced font):
+ 	
+ 	   p   |   q   |   p ==> q
+ 	-------|-------|-------------
+ 	   T   |   T   |      T
+ 	   T   |   F   |      F
+ 	   F   |   T   |      T
+ 	   F   |   F   |      T
+ 	"
+ 
+ 	^self not or: [aBlock value]!

Item was changed:
  ----- Method: Boolean>>==> (in category 'logical operations') -----
  ==> aBlock
  	"this is material implication, a ==> b, also known as:
  			b if a 
  			a implies b
  			if a then b
  			b is a consequence of a
  			a therefore b (but note: 'it is raining therefore it is cloudy' is implication; 'it is autumn therefore the leaves are falling' is equivalence).
  		
  	Here is the truth table for material implication (view in a monospaced font):
  	
  	   p   |   q   |   p ==> q
  	-------|-------|-------------
  	   T   |   T   |      T
  	   T   |   F   |      F
  	   F   |   T   |      T
  	   F   |   F   |      T
  	"
  
+ 	self subclassResponsibility!
- 	^self not or: [aBlock value]!

Item was added:
+ ----- Method: False>>==> (in category 'logical operations') -----
+ ==> aBlock
+ 	^true!

Item was added:
+ ----- Method: True>>==> (in category 'logical operations') -----
+ ==> aBlock
+ 	^aBlock value!




More information about the Squeak-dev mailing list