Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1294.mcz
==================== Summary ====================
Name: Kernel-ct.1294
Author: ct
Time: 9 January 2020, 3:42:36.672555 pm
UUID: 7409dcc3-160e-9d44-9712-f266e0f25973
Ancestors: Kernel-nice.1292
Proposal: Add #haltOnceIf: to Object, which combines the strengths of #haltOnce and #haltIf:. Especially useful in performance-critical situations: It HaltOnce is disabled, the condition will not be evaluated at all.
=============== Diff against Kernel-nice.1292 ===============
Item was changed:
----- Method: Object>>haltIf: (in category 'debugging') -----
+ haltIf: aCondition
+ "This is the typical message to use for inserting breakpoints during debugging. Param can be a block or expression, halt if true.
- haltIf: condition
- "This is the typical message to use for inserting breakpoints during
- debugging. Param can be a block or expression, halt if true.
If the Block has one arg, the receiver is bound to that.
+ If the condition is a selector, we look up in the callchain. Halt if any method's selector equals selector."
- If the condition is a selector, we look up in the callchain. Halt if
- any method's selector equals selector."
- | cntxt |
+ ^ (self meetsHaltCondition: aCondition)
+ ifTrue: [self halt]!
- condition isSymbol ifTrue:[
- "only halt if a method with selector symbol is in callchain"
- cntxt := thisContext.
- [cntxt sender isNil] whileFalse: [
- cntxt := cntxt sender.
- (cntxt selector = condition) ifTrue: [Halt signal].
- ].
- ^self.
- ].
- (condition isBlock
- ifTrue: [condition cull: self]
- ifFalse: [condition]
- ) ifTrue: [
- Halt signal
- ].!
Item was added:
+ ----- Method: Object>>haltOnceIf: (in category 'debugging') -----
+ haltOnceIf: aCondition
+ "Check aCondition and halt, unless we have already done it once. See #meetsHaltCondition:."
+
+ self haltOnceEnabled ifFalse: [^ self].
+ ^ (self meetsHaltCondition: aCondition)
+ ifTrue: [
+ self clearHaltOnce; halt].!
Item was added:
+ ----- Method: Object>>meetsHaltCondition: (in category 'debugging') -----
+ meetsHaltCondition: aCondition
+ "If the Block has one arg, the receiver is bound to that.
+ If the condition is a selector, we look up in the callchain. Halt if any method's selector equals selector."
+
+ aCondition isSymbol ifTrue: [ | ctxt |
+ "only halt if a method with selector symbol is in callchain"
+ ctxt := thisContext.
+ [(ctxt := ctxt sender) isNil] whileFalse: [
+ (ctxt selector = aCondition) ifTrue: [^ true] ].
+ ^ false ].
+ ^ aCondition isBlock
+ ifTrue: [aCondition cull: self]
+ ifFalse: [aCondition value]!
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1491.mcz
==================== Summary ====================
Name: Kernel-ct.1491
Author: ct
Time: 7 November 2022, 8:51:11.997226 pm
UUID: 78f3b27b-1a68-4d42-b796-c7edbe07870c
Ancestors: Kernel-ct.1489, Kernel-ct.1294
Merges Kernel-ct.1294:
Add #haltOnceIf: to Object, which combines the strengths of #haltOnce and #haltIf:. Especially useful in performance-critical situations: It HaltOnce is disabled, the condition will not be evaluated at all.
Revision:
Minor refactoring. Argument renaming, make use of #findContextSuchThat:.
=============== Diff against Kernel-ct.1489 ===============
Item was changed:
----- Method: Object>>haltIf: (in category 'debugging') -----
+ haltIf: aBooleanOrBlockOrSelector
+ "This is the typical message to use for inserting breakpoints during debugging. Param can be a boolean block or value, halt if true.
+ If the block has one arg, the receiver is bound to that.
+ If the argument is a selector, we look up in the callchain. Halt if any method's selector equals selector."
- haltIf: condition
- "This is the typical message to use for inserting breakpoints during
- debugging. Param can be a block or expression, halt if true.
- If the Block has one arg, the receiver is bound to that.
- If the condition is a selector, we look up in the callchain. Halt if
- any method's selector equals selector."
- | cntxt |
+ ^ (self meetsHaltCondition: aBooleanOrBlockOrSelector)
+ ifTrue: [self halt]!
- condition isSymbol ifTrue:[
- "only halt if a method with selector symbol is in callchain"
- cntxt := thisContext.
- [cntxt sender isNil] whileFalse: [
- cntxt := cntxt sender.
- (cntxt selector = condition) ifTrue: [Halt signal].
- ].
- ^self.
- ].
- (condition isBlock
- ifTrue: [condition cull: self]
- ifFalse: [condition]
- ) ifTrue: [
- Halt signal
- ].!
Item was added:
+ ----- Method: Object>>haltOnceIf: (in category 'debugging') -----
+ haltOnceIf: aBooleanOrBlockOrSelector
+ "Check aBooleanOrBlockOrSelector and halt, unless we have already done it once. See #meetsHaltCondition:."
+
+ self haltOnceEnabled ifFalse: [^ self].
+ ^ (self meetsHaltCondition: aBooleanOrBlockOrSelector)
+ ifTrue:
+ [self clearHaltOnce; halt]!
Item was added:
+ ----- Method: Object>>meetsHaltCondition: (in category 'debugging') -----
+ meetsHaltCondition: aBooleanOrBlockOrSelector
+ "If the condition block has one arg, the receiver is bound to that.
+ If the condition is a selector, we look up in the callchain. Halt if any method's selector equals selector."
+
+ aBooleanOrBlockOrSelector isSymbol ifTrue:
+ [^ (thisContext home sender findContextSuchThat: [:ctxt |
+ ctxt selector = aBooleanOrBlockOrSelector])
+ notNil].
+ ^ aBooleanOrBlockOrSelector isBlock
+ ifTrue: [aBooleanOrBlockOrSelector cull: self]
+ ifFalse: [aBooleanOrBlockOrSelector value]!
Eliot Miranda uploaded a new version of VersionNumber to project The Trunk:
http://source.squeak.org/trunk/VersionNumber-eem.5.mcz
==================== Summary ====================
Name: VersionNumber-eem.5
Author: eem
Time: 5 November 2022, 1:36:25.499057 pm
UUID: 8883b385-6d1b-4659-b488-c677c700707a
Ancestors: VersionNumber-cmm.4
Fix VersionNumber>>< so that version numbers of different lengths can be compared. e.g. 1.8 is clearly less than 1.7.4. At the same time fix the comparison so that it terminates as soon as a difference is found.
=============== Diff against VersionNumber-cmm.4 ===============
Item was changed:
----- Method: VersionNumber>>< (in category 'comparing') -----
< another
+ "Answer whether the receiver is less than the argument, another VersionNumber."
- "Answer whether the receiver is less than the argument."
+ | tmp thisSize thatSize this that |
- | tmp |
- (self inSameBranchAs: another) ifFalse:
- [^self error: 'Receiver and argument in different branches'].
-
tmp := another numbers.
+ thisSize := numbers size.
+ thatSize := tmp size.
+ 1 to: (thisSize min: thatSize) do:
+ [:i|
+ (this := numbers at: i) = (that := tmp at: i) ifFalse:
+ [^this < that]].
+ ^thisSize < thatSize!
- (tmp size = numbers size) ifTrue:
- [1 to: numbers size do:
- [ :in | (numbers at: in) < (tmp at: in) ifTrue: [^true]].
- ^false].
-
- ^numbers size < tmp size
- !