Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.1059.mcz
==================== Summary ====================
Name: Collections-cmm.1059
Author: cmm
Time: 18 February 2024, 5:19:05.159381 pm
UUID: 982eb6aa-f237-4e79-a208-ae6b2f23cf1b
Ancestors: Collections-mt.1058
- Let #peek: support a negative number of characters to peekBack:.
- Let SharedQueue2 support #atEnd.
=============== Diff against Collections-mt.1058 ===============
Item was changed:
----- Method: PositionableStream>>peek: (in category 'accessing') -----
+ peek: anInteger
+ ^ anInteger positive
+ ifTrue: [ self peekForward: anInteger ]
+ ifFalse: [ self peekBack: anInteger abs ]!
- peek: anInteger
- "Answer what would be returned if the message next: anInteger were sent to the receiver. If the receiver has less than anInteger more elements, only answer so many elements as available."
-
- | oldPosition result |
- oldPosition := position.
- result := self next: anInteger.
- position := oldPosition.
- ^ result!
Item was added:
+ ----- Method: PositionableStream>>peekBack: (in category 'accessing') -----
+ peekBack: anInteger
+ "Answer anInteger characters previous to the current position, or all to the beginning, whichever is fewer."
+ ^ anInteger negative
+ ifTrue: [ self peek: anInteger negated ]
+ ifFalse:
+ [ | toSkip | toSkip := anInteger min: self position.
+ self
+ skip: toSkip negated ;
+ next: toSkip ]!
Item was added:
+ ----- Method: PositionableStream>>peekForward: (in category 'accessing') -----
+ peekForward: anInteger
+ "Answer what would be returned if the message next: anInteger were sent to the receiver. If the receiver is at the end, answer an empty string."
+ | priorPos result |
+ priorPos := position.
+ result := self next: anInteger.
+ position := priorPos.
+ ^ result!
Item was added:
+ ----- Method: SharedQueue2>>atEnd (in category 'testing') -----
+ atEnd
+ ^ monitor critical: [ items isEmpty ]!
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1553.mcz
==================== Summary ====================
Name: Kernel-ct.1553
Author: ct
Time: 24 February 2024, 8:42:15.180459 pm
UUID: bfcd6789-4af9-cc41-8278-5a27709723d5
Ancestors: Kernel-mt.1551, Kernel-ct.1293
Merges and revises Kernel-ct.1293:
Elaborate method comment in Object >> #copyFrom:
See: https://lists.squeakfoundation.org/archives/list/squeak-dev@lists.squeakfou…
=============== Diff against Kernel-mt.1551 ===============
Item was changed:
----- Method: CompiledCode>>copyFrom: (in category 'copying') -----
copyFrom: anotherObject
+ "Copy to myself all slots I have in common with anotherObject, i.e., all variables names which have the same index in both classes and all element indices which are available in both classes.
+ This is dangerous because it ignores an object's control over its own inst vars."
- "Copy to myself all instance variables I have in common with anotherObject.
- This is dangerous because it ignores an object's control over its own inst vars."
<primitive: 168>
anotherObject isCompiledCode
ifTrue:
[1 to: self numLiterals do:
[:i| self literalAt: i put: (anotherObject literalAt: i)]]
ifFalse:
[1 to: self numLiterals do:
[:i| self literalAt: i put: (anotherObject at: i)]].
self initialPC to: (self basicSize min: anotherObject basicSize) do:
[:i|
self basicAt: i put: (anotherObject basicAt: i)]!
Item was changed:
----- Method: Object>>copyFrom: (in category 'copying') -----
copyFrom: anotherObject
+ "Copy to myself all slots I have in common with anotherObject, i.e., all variables names which have the same index in both classes and all element indices which are available in both classes.
+ This is dangerous because it ignores an object's control over its own inst vars."
- "Copy to myself all instance variables I have in common with anotherObject. This is dangerous because it ignores an object's control over its own inst vars. "
| mine his |
<primitive: 168>
mine := self class allInstVarNames.
his := anotherObject class allInstVarNames.
1 to: (mine size min: his size) do: [:ind |
(mine at: ind) = (his at: ind) ifTrue: [
self instVarAt: ind put: (anotherObject instVarAt: ind)]].
self class isVariable & anotherObject class isVariable ifTrue: [
1 to: (self basicSize min: anotherObject basicSize) do: [:ind |
self basicAt: ind put: (anotherObject basicAt: ind)]].!
Item was changed:
----- Method: Object>>copySameFrom: (in category 'copying') -----
copySameFrom: otherObject
"Copy to myself all instance variables named the same in otherObject.
+ This is dangerous because it ignores an object's control over its own inst vars."
- This ignores otherObject's control over its own inst vars."
| myInstVars otherInstVars |
myInstVars := self class allInstVarNames.
otherInstVars := otherObject class allInstVarNames.
myInstVars withIndexDo: [:each :index |
| match |
(match := otherInstVars indexOf: each) > 0 ifTrue:
[self instVarAt: index put: (otherObject instVarAt: match)]].
1 to: (self basicSize min: otherObject basicSize) do: [:i |
self basicAt: i put: (otherObject basicAt: i)].
!
Christoph Thiede uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ct.417.mcz
==================== Summary ====================
Name: KernelTests-ct.417
Author: ct
Time: 29 December 2021, 6:16:09.754165 pm
UUID: 3f9894ac-a774-b44d-85bf-0846ac062cb2
Ancestors: KernelTests-ct.416
Acceptance tests for #runUntilErrorOrReturnFrom:.
Given the complexity of the underlying method, I would like to gently request a short feedback from the author (Eliot) whether all assumptions in these tests are correct. :-)
=============== Diff against KernelTests-ct.416 ===============
Item was added:
+ ----- Method: ContextTest>>testRunUntilErrorOrReturnFromError (in category 'tests') -----
+ testRunUntilErrorOrReturnFromError
+
+ | context process result sender error |
+ process := [self error] newProcess.
+ process runUntil: [:ctxt | ctxt receiver == self].
+ context := process suspendedContext.
+ sender := context sender.
+
+ result := context runUntilErrorOrReturnFrom: context.
+ context := result first.
+ error := result second.
+
+ self assert: (context hasSender: sender).
+ self assert: (Error handles: error).!
Item was added:
+ ----- Method: ContextTest>>testRunUntilErrorOrReturnFromNoError (in category 'tests') -----
+ testRunUntilErrorOrReturnFromNoError
+
+ | context process result sender error |
+ process := [6 * 7] newProcess.
+ process runUntil: [:ctxt | ctxt receiver == self].
+ context := process suspendedContext.
+ sender := context sender.
+
+ result := context runUntilErrorOrReturnFrom: context.
+ context := result first.
+ error := result second.
+
+ self assert: sender equals: context.
+ self assert: nil equals: error.
+ self assert: 42 equals: context top.!