[squeak-dev] beReadOnlyObject (was: FileStreams Limit)

David T. Lewis lewis at mail.msen.com
Sat Feb 19 15:32:18 UTC 2022

On Sat, Feb 19, 2022 at 02:27:48PM +0100, J??rg Belger wrote:
> > Am 19.02.2022 um 14:14 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> > 
> > For immutability, please see #beReadOnlyObject.
> > 
> I cannot find the #beReadOnlyObject with MethodFinder in 5.3 or in class Object

Eliot added this last March, so it is in the trunk image now but was
not present in the 5.3 release image.

A new 6.0 release is expected some time in the next month or so, but
in the mean time you can find #beReadOnlyObject in the current trunk
image (the download link is at https://squeak.org/downloads/), or you
can update an existing 5.3 image (preferences browser, category "updates",
change the Update URL to http://source.squeak.org/trunk, then Update
Squeak from the mouse menu at upper left).

Here the the commit notices from the trunk update stream:

Name: Kernel-eem.1317
Author: eem
Time: 11 March 2020, 1:12:02.344414 pm
UUID: 3755843a-380e-4cbc-a498-b1f1a85f2906
Ancestors: Kernel-eem.1316

Add the core of read-only support, which will provide both for read-only literals and for efficient write-through cacheing to object databases such as gemstone.

This implementation differs slightly from Clément Béra's original implementatin for Pharo in that here ModificationForbidden always uses a mirror (either a Context or a Class) to attempt to modify the read-only
object in retryModification.

Name: Kernel-eem.1318
Author: eem
Time: 11 March 2020, 6:49:23.875063 pm
UUID: 25265ede-0f88-439d-8800-8a39e3f1898a
Ancestors: Kernel-eem.1317

Read-only object support.

Have ModificationForbidden allow retrying modification without resuming (retryModificationNoResume) or resuming (retryModificatio).  Ideally this would just be retryModification and resume but Pharo got there first and compatibility is a virtue.

Add BinaryModificationForbidden to support Array and the elementsExchangeIdentityWith: become machinery, and simplify the Behavior adoptInstance: mchinery.  Decouople resumeValue from newValue to allow Array and the elementsExchangeIdentityWith: become machinery to answer the correct result.

Extend the execution simulation machionery to correctly simulate attempting to assign the inst vars of read-only objects.

Add Object class>>releaseNotes as a scratch pad for people to add things that should appear in the release notes.

More information about the Squeak-dev mailing list