Reference.reachabilityFence

Vitaly Davidovich vitalyd at gmail.com
Tue Nov 24 17:27:29 UTC 2015


>
> The choice of reachabilityFence was in part motivated by hearing
> about mistakes in using C# keepAlive where people would place keepAlive
> before uses of fields, rather than after them. A more accurate name
> should reduce this error in Java.


I don't see how reachabilityFence would help prevent that type of
mistake/usage.  Having used KeepAlive in .NET, I personally think it's a
better and more appropriate name and has the "demarcation" aspect (i.e.
"keep this alive until the point where I wrote KeepAlive").  But, it's a
bikeshed so I won't get hung up on it.

On Tue, Nov 24, 2015 at 12:06 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 11/24/2015 09:09 AM, Andrew Haley wrote:
>
>> Bikeshedding,
>>
>> On 11/24/2015 01:07 PM, Vitaly Davidovich wrote:
>>
>>> How about keepAlive? Reference.keepAlive(Object) reads better, IMO.
>>>
>>
>> It does indeed.  Imperative names for methods almost always read better,
>> IMO.  And although we probably don't don't much care about C#, it too
>> uses the name KeepAlive() for this.
>>
>
> Well, it is not an imperative notion, it is a demarcation.
> More like a semicolon than an action. (Which is the realm of fences.)
>
> The choice of reachabilityFence was in part motivated by hearing
> about mistakes in using C# keepAlive where people would place keepAlive
> before uses of fields, rather than after them. A more accurate name
> should reduce this error in Java.
>
> -Doug
>
>
>



More information about the core-libs-dev mailing list