[squeak-dev] The Trunk: Kernel-cmm.1113.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Sep 1 16:40:39 UTC 2017



> On Aug 31, 2017, at 11:57 PM, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
> 
> +1
> 
> #setPinned: looks like it is coming from C land or Java land. :) #pinned:, #pin, and #unpin are more idiomatic for Smalltalk code.

I struggle NFL time disagree.  setPinned: is a low level interface to the VM, not user API.  isPinned, pin & unpin are the user API.  And as mentioned elsewhere these might better be named isPinnedInMemory, pinInMemory & unpinInMemory.


> Best,
> Marcel
>> Am 01.09.2017 03:01:55 schrieb Chris Muller <asqueaker at gmail.com>:
>> 
>> Hi Levente,
>> 
>> #setPinned: is a private method that provides a physical kind of
>> access to the object, whereas #pinned: is public, conforms to expected
>> naming conventions and allows (proper) overriding. It provides a
>> logical (abstract) kind of access to #setPinned: as do #pin and
>> #unpin.
>> 
>> I'd recommend using #pin and #unpin if wherever possible, but there
>> have been enough cases where various method pairs (i.e., #lock/unlock,
>> #show/hide, #action/unaction, etc.) where it can't be known which one
>> is needed until runtime.
>> 
>> - Chris
>> 
>> On Thu, Aug 31, 2017 at 5:24 PM, Levente Uzonyi wrote:
>> > On Thu, 31 Aug 2017, commits at 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.
>> >> - This primitive either pins or unpins an object, and answers if it
>> >> was already pinned."
>> >> 
>> >> ^self primitiveFailed!
>> >>
>> >> 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!
>> >
>> >
>> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170901/2a862fcd/attachment.html>


More information about the Squeak-dev mailing list