Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.459.mcz
==================== Summary ====================
Name: Tests-nice.459
Author: nice
Time: 29 April 2021, 10:30:03.551961 pm
UUID: 67799656-9640-e447-b665-6f74573e3716
Ancestors: Tests-nice.458
For some reason, ImageSegmentTest>>testContextsShouldBeWritableToaFile interact badly with progress bar, resulting in a context that cannotReturn:
Workaround by temporarily suppressing progress.
=============== Diff against Tests-nice.458 ===============
Item was changed:
----- Method: ImageSegmentTest>>testContextsShouldBeWritableToaFile (in category 'tests') -----
testContextsShouldBeWritableToaFile
"This should not throw an exception"
+ [NativeImageSegment new
- NativeImageSegment new
copyFromRoots: {thisContext. thisContext copyStack} sizeHint: 100;
extract;
writeToFile: 'ContextChain';
+ yourself] on: ProgressInitiationException do: [:e | e resumeSuppressingProgress]
- yourself
"TODO: write assertions showing that something meaningful actually happened."
"TODO: bring them back in again"!
Hi all,
recently I stumbled upon an extension method for Dictionary which *might* fit well into the Trunk:
Dictionary >> #at: key ifAbsentPut: startBlock ifPresentPut: nextBlock
"(c) 2020 Basti Kruck und Marcel Taeumel. :-)" (self includesKey: key) ifFalse: [
^ self at: key put: startBlock value]. ^ self
at: key
put: (nextBlock value: (self at: key))
See https://github.com/hpi-swa/vivide/blob/c4ac5ea562bd563358d52ee41c149a3fbcff….
Usage:
counter := counters at: key ifAbsentPut: [0] ifPresentPut: [:i | i + 1]
What do you think, should we copy this into the Trunk? Or is it just fine to do something like this instead at the sender side:
counter := counters at: key put: (counters at: key ifAbsent: [0] ifPresent: [:i | i + 1])
<http://www.hpi.de/>
Also, I'm not sure about the order of arguments.
Best,
Christoph
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1397.mcz
==================== Summary ====================
Name: Kernel-nice.1397
Author: nice
Time: 30 April 2021, 9:48:57.972338 pm
UUID: df20ab21-bba8-4919-b4a1-d2c7a6c6e8de
Ancestors: Kernel-mt.1396, Kernel-jar.1395
merge Kernel-jar.1395 (fix outer)
=============== Diff against Kernel-mt.1396 ===============
Item was changed:
----- Method: Exception>>outer (in category 'handling') -----
outer
"Evaluate the enclosing exception action and return to here instead of signal if it resumes (see #resumeUnchecked:)."
+ | prevOuterContext currHandlerContext |
- | prevOuterContext |
self isResumable ifTrue: [
+ currHandlerContext := handlerContext.
prevOuterContext := outerContext.
outerContext := thisContext contextTag.
].
self pass.
!
Item was changed:
----- Method: Exception>>resumeUnchecked: (in category 'handling') -----
resumeUnchecked: resumptionValue
"Return resumptionValue as the value of #signal, unless this was called after an #outer message, then return resumptionValue as the value of #outer."
| ctxt |
outerContext ifNil: [
signalContext return: resumptionValue
] ifNotNil: [
ctxt := outerContext.
outerContext := ctxt tempAt: 1. "prevOuterContext in #outer"
+ handlerContext := ctxt tempAt: 2. "currHandlerContext in #outer"
ctxt return: resumptionValue
].
!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-jar.1395.mcz
==================== Summary ====================
Name: Kernel-jar.1395
Author: jar
Time: 30 April 2021, 12:25:17.561362 am
UUID: 0f589a20-6b8e-a94b-9dbc-9b3f91c84ce8
Ancestors: Kernel-nice.1394
Fix a bug in Exception>>#outer causing a return to an incorrect handler context. Explanation in: http://forum.world.st/A-bug-in-Exception-gt-gt-outer-causing-a-return-to-an…
=============== Diff against Kernel-nice.1394 ===============
Item was changed:
----- Method: Exception>>outer (in category 'handling') -----
outer
"Evaluate the enclosing exception action and return to here instead of signal if it resumes (see #resumeUnchecked:)."
+ | prevOuterContext currHandlerContext |
- | prevOuterContext |
self isResumable ifTrue: [
+ currHandlerContext := handlerContext.
prevOuterContext := outerContext.
outerContext := thisContext contextTag.
].
self pass.
!
Item was changed:
----- Method: Exception>>resumeUnchecked: (in category 'handling') -----
resumeUnchecked: resumptionValue
"Return resumptionValue as the value of #signal, unless this was called after an #outer message, then return resumptionValue as the value of #outer."
| ctxt |
outerContext ifNil: [
signalContext return: resumptionValue
] ifNotNil: [
ctxt := outerContext.
outerContext := ctxt tempAt: 1. "prevOuterContext in #outer"
+ handlerContext := ctxt tempAt: 2. "currHandlerContext in #outer"
ctxt return: resumptionValue
].
!