Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.458.mcz
==================== Summary ====================
Name: Tests-nice.458
Author: nice
Time: 28 April 2021, 6:11:51.033213 pm
UUID: 13fec56a-805e-754e-bd02-8cbaa015e102
Ancestors: Tests-jr.457
Document the fact that becomeForward: does NOT forward identityHash of receiver anymore (since Collections-eem.885 April 2020)
See #elementsForwardIdentityTo: vs #elementsForwardIdentityAndHashTo:
See also http://forum.world.st/How-to-become-immediate-objects-td5114931.html
=============== Diff against Tests-jr.457 ===============
Item was changed:
----- Method: BecomeTest>>testBecomeForward (in category 'tests') -----
testBecomeForward
"Test the forward become."
| a b c d |
a := 'ab' copy.
b := 'cd' copy.
+ c := Array with: a.
- c := a.
d := b.
a becomeForward: b.
self
assert: a = 'cd';
assert: b = 'cd';
+ assert: a == b;
+ assert: c first == b;
+ assert: d == b.
- assert: c = 'cd';
- assert: d = 'cd'.
-
!
Item was added:
+ ----- Method: BecomeTest>>testBecomeForwardCopyIdentityHash (in category 'tests') -----
+ testBecomeForwardCopyIdentityHash
+ "Check that
+ 1. the argument to becomeForward: is modified to have the receiver's identity hash.
+ 2. the receiver's identity hash is unchanged."
+
+ | a b ha |
+
+ a := 'ab' copy.
+ b := 'cd' copy.
+ ha := a identityHash.
+
+ a becomeForward: b copyHash: true.
+
+ self
+ assert: a identityHash = ha;
+ assert: b identityHash = ha.
+
+ !
Item was changed:
----- Method: BecomeTest>>testBecomeForwardDontCopyIdentityHash (in category 'tests') -----
testBecomeForwardDontCopyIdentityHash
"Check that
1. the argument to becomeForward: is NOT modified to have the receiver's identity hash.
+ 2. the receiver's identity hash is changed."
- 2. the receiver's identity hash is unchanged."
| a b hb |
a := 'ab' copy.
b := 'cd' copy.
hb := b identityHash.
a becomeForward: b copyHash: false.
self
assert: a identityHash = hb;
assert: b identityHash = hb.
!
Item was changed:
----- Method: BecomeTest>>testBecomeForwardIdentityHash (in category 'tests') -----
testBecomeForwardIdentityHash
+ "Document that the receiver hash is changed, but the argument hash is unchanged.
+ (a becomeForward: b) has thus same effect as (a becomeForward: b copyHash: false)"
- "Check that
- 1. the argument to becomeForward: is modified to have the receiver's identity hash.
- 2. the receiver's identity hash is unchanged."
+ | a b hb |
- | a b ha |
a := 'ab' copy.
b := 'cd' copy.
+ hb := b identityHash.
- ha := a identityHash.
a becomeForward: b.
self
+ assert: a identityHash = hb;
+ assert: b identityHash = hb.
- assert: a identityHash = ha;
- assert: b identityHash = ha.
!
A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler-ct.459.mcz
==================== Summary ====================
Name: Compiler-ct.459
Author: ct
Time: 1 May 2021, 2:01:39.875973 pm
UUID: be6611f2-9aec-cd49-91be-43ac1fec67ca
Ancestors: Compiler-nice.458
Recategorizes OutOfScopeNotification>>#defaultAction
=============== Diff against Compiler-nice.458 ===============
Item was changed:
+ ----- Method: OutOfScopeNotification>>defaultAction (in category 'priv handling') -----
- ----- Method: OutOfScopeNotification>>defaultAction (in category 'as yet unclassified') -----
defaultAction
^false!
Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1391.mcz
==================== Summary ====================
Name: Kernel-nice.1391
Author: nice
Time: 23 April 2021, 10:58:48.925778 am
UUID: bde1d6d3-e3ba-48ad-b432-3ac5a1531880
Ancestors: Kernel-nice.1390
Remove the questionable ifCurtailed: block that did reactivate the handler in handleSignal:, and make the handling symetric, whether the handlerAction explicitily use exception return or not.
Document the mysterious tempAt:/tempAt:put: intention by using proper method names as requested by Marcel.
The slowdown shall be marginal, and system understanding should be improved.
Provide messages to selectively reactivate some handler contexts. For gurus: handle with care!
=============== Diff against Kernel-nice.1390 ===============
Item was changed:
----- Method: Context>>canHandleSignal: (in category 'private-exceptions') -----
canHandleSignal: exception
"Sent to handler (on:do:) contexts only. If my exception class (first arg) handles exception then return true, otherwise forward this message to the next handler context. If none left, return false (see nil>>canHandleSignal:)"
+ ^ (self willHandleSignal: exception)
- ^ (((self tempAt: 1) handles: exception) and: [self tempAt: 3])
or: [self nextHandlerContext canHandleSignal: exception].
!
Item was added:
+ ----- Method: Context>>deactivateHandler (in category 'private-exceptions') -----
+ deactivateHandler
+ "Private - sent to exception handler context only (on:do:)"
+
+ stackp >= 3 ifTrue: [self tempAt: 3 put: false] "this is temporary handlerActive in #on:do:"!
Item was added:
+ ----- Method: Context>>fireHandlerActionWith: (in category 'private-exceptions') -----
+ fireHandlerActionWith: exception
+ "Sent to handler (on:do:) contexts only.
+ Perform the second argument, which is the handler action"
+
+ ^(self tempAt: 2) cull: exception!
Item was changed:
----- Method: Context>>handleSignal: (in category 'private-exceptions') -----
handleSignal: exception
"Sent to handler (on:do:) contexts only. If my exception class (first arg) handles exception
and the handler is active then execute my handle block (second arg), otherwise forward
this message to the next handler context. If none left, execute exception's defaultAction
(see nil>>handleSignal:)."
+ | val |
+ (self willHandleSignal: exception) ifFalse:
+ [self deactivateHandler.
- | handlerActive val |
- "If the context has been returned from the handlerActive temp var may not be accessible."
- handlerActive := stackp >= 3 and: [(self tempAt: 3) == true].
- (((self tempAt: 1) handles: exception) and: [handlerActive]) ifFalse:
- [stackp >= 3 ifTrue: [self tempAt: 3 put: false].
^self nextHandlerContext handleSignal: exception].
exception privHandlerContext: self contextTag.
+ self deactivateHandler. "disable self while executing handle block"
+ val := self fireHandlerActionWith: exception.
- self tempAt: 3 put: false. "disable self while executing handle block"
- val := [(self tempAt: 2) cull: exception]
- ifCurtailed: [self tempAt: 3 put: true].
self return: val "return from self if not otherwise directed in handle block"
!
Item was added:
+ ----- Method: Context>>isHandlerActive (in category 'private-exceptions') -----
+ isHandlerActive
+ "Private - sent to exception handler context only (on:do:)"
+
+ ^stackp >= 3 and: [(self tempAt: 3) == true] "this is temporary handlerActive in #on:do:"!
Item was added:
+ ----- Method: Context>>reactivateHandler (in category 'private-exceptions') -----
+ reactivateHandler
+ "Private - sent to exception handler context only (on:do:)"
+
+ stackp >= 3 ifTrue: [self tempAt: 3 put: true] "this is temporary handlerActive in #on:do:"!
Item was changed:
----- Method: Context>>reactivateHandlers (in category 'private-exceptions') -----
reactivateHandlers
"Private - sent to exception handler context only (on:do:).
Reactivate all the handlers into the chain"
+ self reactivateHandler.
- self tempAt: 3 put: true. "this is temporary handlerActive in #on:do:"
self nextHandlerContext reactivateHandlers!
Item was added:
+ ----- Method: Context>>reactivateHandlersUpTo: (in category 'private-exceptions') -----
+ reactivateHandlersUpTo: aHandlerContext
+ "Private - sent to exception handler context only (on:do:).
+ Reactivate the inner handlers into the chain, up to, but not including, aHandlerContext"
+
+ self == aHandlerContext ifTrue: [^self].
+ self reactivateHandler.
+ self nextHandlerContext reactivateHandlersUpTo: aHandlerContext!
Item was added:
+ ----- Method: Context>>reactivateHandlersWhich:upTo: (in category 'private-exceptions') -----
+ reactivateHandlersWhich: selectBlock upTo: aHandlerContext
+ "Private - sent to exception handler context only (on:do:).
+ Reactivate the inner handlers into the chain, up to, but not including, aHandlerContext, that satisfy the selectBlock predicate"
+
+ self == aHandlerContext ifTrue: [^self].
+ (selectBlock value: self) ifTrue: [self reactivateHandler].
+ self nextHandlerContext reactivateHandlersWhich: selectBlock upTo: aHandlerContext!
Item was changed:
----- Method: Context>>rearmHandlerDuring: (in category 'private-exceptions') -----
rearmHandlerDuring: aBlock
"Sent to handler (on:do:) contexts only. Makes me re-entrant for the duration of aBlock. Only works in a closure-enabled image"
+ ^ [self reactivateHandler. aBlock value]
+ ensure: [self deactivateHandler]!
- ^ [self tempAt: 3 put: true. aBlock value]
- ensure: [self tempAt: 3 put: false]!
Item was added:
+ ----- Method: Context>>willHandleSignal: (in category 'private-exceptions') -----
+ willHandleSignal: exception
+ "Sent to handler (on:do:) contexts only."
+
+ ^self isHandlerActive and: [(self tempAt: 1) handles: exception]
+ !
Item was added:
+ ----- Method: Exception>>reactivateHandlersUpTo: (in category 'priv handling') -----
+ reactivateHandlersUpTo: aHandlerContext
+ "reactivate all the exception handlers in the context chain"
+ self canSearchForSignalerContext
+ ifTrue: [signalContext nextHandlerContext reactivateHandlersUpTo: aHandlerContext]!
Item was added:
+ ----- Method: UndefinedObject>>reactivateHandlersUpTo: (in category 'bottom context') -----
+ reactivateHandlersUpTo: aHandlerContext
+
+ ^ self!
Item was added:
+ ----- Method: UndefinedObject>>reactivateHandlersWhich:upTo: (in category 'bottom context') -----
+ reactivateHandlersWhich: selectBlock upTo: aHandlerContext
+
+ ^ self!
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-jar.1398.mcz
==================== Summary ====================
Name: Kernel-jar.1398
Author: jar
Time: 2 May 2021, 2:56:26.972089 pm
UUID: 9398993d-726c-8747-bde6-506318c4f898
Ancestors: Kernel-nice.1397
Fix a bug in #resignalAs causing an incorrect evaluation of resignalAs in combination with #outer. Complemented with a test in Tests-jar.461 (Inbox)
To illustrate the bug try:
| x |
x:=''.
[
[1/0. x:=x,'1'] on: ZeroDivide do: [:ex | ex outer. x:=x,'2'].
x:=x,'3'
] on: ZeroDivide do: [:ex | ex resignalAs: Notification].
x
answers:
---> '2' currently - incorrect
---> '13' after the fix
=============== Diff against Kernel-nice.1397 ===============
Item was changed:
----- Method: Exception>>resignalAs: (in category 'handling') -----
resignalAs: replacementException
+ "Signal an alternative exception in place of the receiver.
+ Unwind to signalContext before signalling the replacement exception"
- "Signal an alternative exception in place of the receiver."
+ signalContext resumeEvaluating: [replacementException signal]!
- self resumeEvaluating: [replacementException signal]!
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"!
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1054.mcz
==================== Summary ====================
Name: Tools-mt.1054
Author: mt
Time: 1 May 2021, 12:06:08.609299 pm
UUID: 9da21c77-f717-ab4c-b024-42dfbe629f2e
Ancestors: Tools-mt.1053
Adds preference and means to embed a transcript in workspaces. Thanks to Jaromir (jar) for the idea!
The preference is disabled by default.
=============== Diff against Tools-mt.1053 ===============
Item was changed:
StringHolder subclass: #Workspace
instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle environment'
+ classVariableNames: 'DeclareVariablesAutomatically EmbedTranscript LookupPools ShouldStyle'
- classVariableNames: 'DeclareVariablesAutomatically LookupPools ShouldStyle'
poolDictionaries: ''
category: 'Tools-Base'!
!Workspace commentStamp: 'fbs 6/2/2012 20:46' prior: 0!
A Workspace is a text area plus a lot of support for executable code. It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.
To open a new workspace, execute:
Workspace open
A workspace can have its own variables, called "workspace variables", to hold intermediate results. For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.
Additionally, in Morphic, a workspace can gain access to morphs that are on the screen. If acceptDroppedMorphs is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph. This functionality is toggled with the window-wide menu of a workspace.
The instance variables of this class are:
bindings - holds the workspace variables for this workspace
acceptDroppedMorphs - whether dropped morphs should create new variables!
Item was added:
+ ----- Method: Workspace class>>embedTranscript (in category 'preferences') -----
+ embedTranscript
+ <preference: 'Embed a Transcript in Workspace'
+ category: 'browsing'
+ description: 'If true, new workspaces will open with an embedded Transcript.'
+ type: #Boolean>
+ ^ EmbedTranscript ifNil: [ false ]!
Item was added:
+ ----- Method: Workspace class>>embedTranscript: (in category 'preferences') -----
+ embedTranscript: aBoolean
+
+ EmbedTranscript := aBoolean.!
Item was added:
+ ----- Method: Workspace>>buildTranscriptWith: (in category 'toolbuilder') -----
+ buildTranscriptWith: builder
+
+ | textSpec |
+ textSpec := builder pluggableTextSpec new.
+ textSpec
+ model: Transcript;
+ menu: #codePaneMenu:shifted:.
+ ^ textSpec!
Item was added:
+ ----- Method: Workspace>>buildWith: (in category 'toolbuilder') -----
+ buildWith: builder
+
+ ^ self class embedTranscript
+ ifTrue: [self buildWorkspaceTranscriptWith: builder]
+ ifFalse: [super buildWith: builder]!
Item was added:
+ ----- Method: Workspace>>buildWorkspaceTranscriptWith: (in category 'toolbuilder') -----
+ buildWorkspaceTranscriptWith: builder
+
+ | windowSpec |
+ windowSpec := self buildWindowWith: builder specs: {
+ (0.0 @ 0.0 corner: 1.0 @ 0.6) -> [self buildCodePaneWith: builder].
+ (0.0 @ 0.6 corner: 1.0 @ 1.0) -> [self buildTranscriptWith: builder].
+ }.
+ ^builder build: windowSpec!