Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.1078.mcz
==================== Summary ====================
Name: Tools-mt.1078
Author: mt
Time: 29 November 2021, 5:40:09.040615 pm
UUID: c2a87084-33a1-4a59-ac39-4b74a4035f8e
Ancestors: Tools-pre.1077
In workspaces, fixes minor issue with how #fileDirectory and #windowTitle are stored.
Thanks to Christoph (ct) for pointing this out.
=============== Diff against Tools-pre.1077 ===============
Item was changed:
----- Method: Workspace>>fileDirectory (in category 'accessing') -----
fileDirectory
"Answer the current directory for save-contents requests."
+ ^ (self valueOfProperty: #fileDirectory) ifNil: [FileDirectory default]!
- ^ self valueOfProperty: #fileDirectory ifAbsent: [FileDirectory default]!
Item was changed:
----- Method: Workspace>>windowTitle (in category 'accessing') -----
windowTitle
+ ^ (self valueOfProperty: #windowTitle) ifNil: ['Workspace']!
- ^ self valueOfProperty: #windowTitle ifAbsent: ['Workspace']!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1803.mcz
==================== Summary ====================
Name: Morphic-mt.1803
Author: mt
Time: 29 November 2021, 11:17:49.411615 am
UUID: 8dc2a08e-8d6a-40a8-9363-63825d568895
Ancestors: Morphic-mt.1802
Adds confirmation dialog to avoid inadvertent loss of unsaved work via keyboard shortcuts.
The shorcut is CTRL+L, which might be triggered via CTRL+PageDown, depending on your platform and preferences.
See http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-November/217224…
=============== Diff against Morphic-mt.1802 ===============
Item was changed:
----- Method: TextEditor>>cancel (in category 'menu messages') -----
cancel
"Cancel the changes made so far to this text"
+
+ model okToChange
+ ifTrue: [morph cancelEdits].!
- morph cancelEdits!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1428.mcz
==================== Summary ====================
Name: Kernel-nice.1428
Author: nice
Time: 28 November 2021, 10:44:44.154815 pm
UUID: a8a214a1-7879-4782-8dd7-910f183fda65
Ancestors: Kernel-nice.1427
Simplify code for integer division, and marginally fast up some edge case like (SmallInteger / LargeInteger)
Discussion:
Integer was trying to handle case of exact division (Integer / Integer) by performing a quorem operation (digitDiv:neg:), in the hope that avoiding the creation of an unecessary Fraction intermediate would fast things up.
But it appears that digitDiv:neg: does no good nowadays.
- primitive 10 for SmallInteger/SmallInteger case,
- primitive 30 for Integer/Integer case (up to 64 bits)
already handle exact division (their sole purpose if they exist!).
If 10 & 30 are not implemented (they are optional), probably we do not care that much about such micro optimization anyway.
in mixed cases:
- (SmallInteger / LargeInteger), division cannot be exact - except for 0 receiver, so we're just wasting time
Anyway, digitDiv:neg: creates a LargeInteger object for each SmallInteger receiver/argument, and an Array for the resulting quotient and remainder, so in term of creating intermediate objects, it's not much better.
It is also pure waste of time if division is inexact - and division tend to not be cheap for LargeInteger.
Also, gcd: algorithm used in Fraction>>#reduced performs well enough in the case of exact division.
While at it, only handle zero divide in Integer/Integer case.
Let further dispatching handle the case for mixed Integer/Number arithmetic (Integer shall mind its own business).
Note that Fraction>>#setNumerator:denominator: already signal the ZeroDivide, but would not resume: correctly (we send #reduced to the result, which assumes that it is a Fraction)
Warning: benchmarking and understanding the marginal fast-up is not easy, because we have:
- a special bytecode for division
- special primitive for 64 bits integer range
- jit for some of those primitives
that's many cases.
Thanks to https://github.com/pharo-project/pharo/pull/10385 for asking.
=============== Diff against Kernel-nice.1427 ===============
Item was changed:
----- Method: Integer>>/ (in category 'arithmetic') -----
/ aNumber
"Refer to the comment in Number / "
- | quoRem |
aNumber isInteger ifTrue:
+ [aNumber isZero
+ ifTrue: [^(ZeroDivide dividend: self) signal].
+ ^ (Fraction numerator: self denominator: aNumber) reduced].
- [quoRem := self divideByInteger: aNumber.
- (quoRem at: 2) = 0
- ifTrue: [^ (quoRem at: 1) normalize]
- ifFalse: [^ (Fraction numerator: self denominator: aNumber) reduced]].
^ aNumber adaptToInteger: self andSend: #/!
Item was changed:
----- Method: SmallInteger>>/ (in category 'arithmetic') -----
/ aNumber
"Primitive. This primitive (for /) divides the receiver by the argument
and returns the result if the division is exact. Fail if the result is not a
whole integer. Fail if the argument is 0 or is not a SmallInteger. Optional.
No Lookup. See Object documentation whatIsAPrimitive."
<primitive: 10>
+ ^super / aNumber!
- aNumber isZero ifTrue: [^(ZeroDivide dividend: self) signal].
- ^(aNumber isMemberOf: SmallInteger)
- ifTrue: [(Fraction numerator: self denominator: aNumber) reduced]
- ifFalse: [super / aNumber]!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1427.mcz
==================== Summary ====================
Name: Kernel-nice.1427
Author: nice
Time: 28 November 2021, 6:42:41.820989 pm
UUID: 6681ef5b-1b4a-42e1-95cf-ac56a7757b58
Ancestors: Kernel-ct.1426, Kernel-eem.1426
Merge Kernel-ct.1426, Kernel-eem.1426
=============== Diff against Kernel-ct.1426 ===============
Item was added:
+ ----- Method: Message>>hasIdenticalContentsAs: (in category 'comparing') -----
+ hasIdenticalContentsAs: aMessage
+ "Answer if the argument's selector and arguments are identically equal to those of the receiver.
+ It is assumed that the argument aMessage is, in fact, a message."
+ selector ~~ aMessage selector ifTrue:
+ [^false].
+ 1 to: args size do:
+ [:i| (args at: i) ~~ (aMessage arguments at: i) ifTrue: [^false]].
+ ^true!
Item was changed:
----- Method: Object>>doesNotUnderstand: (in category 'error handling') -----
doesNotUnderstand: aMessage
"Handle the fact that there was an attempt to send the given
message to the receiver but the receiver does not understand
this message (typically sent from the machine when a message
+ is sent to the receiver and no method is defined for that selector).
- is sent to the receiver and no method is defined for that selector)."
+ Raise the MessageNotUnderstood signal. If it is caught, answer
+ the result supplied by the exception handler. If it is not caught,
+ answer the result of resending the message within a guard for
+ infinite recursion. This allows, for example, the programmer to
+ implement the method and continue."
+
"Testing: (3 activeProcess)"
| exception resumeValue |
(exception := MessageNotUnderstood new)
message: aMessage;
receiver: self.
resumeValue := exception signal.
+ ^exception reachedDefaultHandler "i.e. exception was not caught..."
+ ifTrue:
+ [[aMessage sentTo: self]
+ on: MessageNotUnderstood
+ do: [:ex|
+ (self == ex receiver
+ and: [aMessage hasIdenticalContentsAs: ex message]) ifFalse:
+ [ex pass].
+ self error: 'infinite recursion in doesNotUnderstand:']]
- ^exception reachedDefaultHandler
- ifTrue: [aMessage sentTo: self]
ifFalse: [resumeValue]!