On Thu, 31 Aug 2017, commits@source.squeak.org wrote:
Chris Muller uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-cmm.1113.mcz
==================== Summary ====================
Name: Kernel-cmm.1113 Author: cmm Time: 31 August 2017, 1:55:06.158647 pm UUID: 05c89229-0279-4842-b0d0-dacb2713a4b6 Ancestors: Kernel-tbn.1112
Provide #pinned: so clients don't have to write duplicate code (e.g., "myCondition ifTrue: [myObject pin] ifFalse: [myObject unpin]") while allowing frameworks to hook #pinned: if necessary (without overriding a primitive).
I'd like to see a use-case which justifies the existence of this method. I also don't see why would you use #pinned: instead of #setPinned:.
Levente
=============== Diff against Kernel-tbn.1112 ===============
Item was changed: ----- Method: Object>>pin (in category 'pinning') ----- pin
- "Ensure the receiver is pinned and answer whether it was pinned."
- ^ self pinned: true!
- "The VM's garbage collector routinely moves objects as it reclaims and compacts
memory. But it can also pin an object so that it will not be moved, which can make
it easier to pass objects out through the FFI. Objects are unpinnned when created.
This method ensures an object is pinned, and answers whether it was already pinned."
- ^self setPinned: true!
Item was added:
- ----- Method: Object>>pinned: (in category 'pinning') -----
- pinned: aBoolean
- "The VM's garbage collector routinely moves objects as it reclaims and compacts memory. But it can also pin an object so that it will not be moved, which can make it easier to pass objects out through the FFI. Objects are unpinnned when created.
- Answer whether the receiver was pinned."
- ^ self setPinned: aBoolean!
Item was changed: ----- Method: Object>>setPinned: (in category 'private') ----- setPinned: aBoolean
- "Primitive which pins or unpins the receiver and answers whether it was already pinned."
- "The VM's garbage collector routinely moves objects as it reclaims and compacts
memory. But it can also pin an object so that it will not be moved, which can make
it easier to pass objects out through the FFI. Objects are unpinnned when created.
<primitive: 184 error: ec> ^self primitiveFailed!This primitive either pins or unpins an object, and answers if it was already pinned."
Item was changed: ----- Method: Object>>unpin (in category 'pinning') ----- unpin
- "Ensure the receiver is unpinned and answer whether it was pinned."
- ^ self pinned: false!
- "The VM's garbage collector routinely moves objects as it reclaims and compacts
memory. But it can also pin an object so that it will not be moved, which can make
it easier to pass objects out through the FFI. Objects are unpinnned when created.
This method ensures an object is unpinned, and answers whether it was pinned."
- ^self setPinned: false!