Reference.reachabilityFence

Doug Lea dl at cs.oswego.edu
Tue Nov 24 17:06:14 UTC 2015


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