Danger Will Robinson! Missing API!

Rémi Forax forax at univ-mlv.fr
Thu May 26 02:52:07 PDT 2011


On 05/26/2011 10:16 AM, John Rose wrote:
> On May 25, 2011, at 11:04 PM, Charles Oliver Nutter wrote:
>
>> I don't say it's not clever. It's just not something anyone is
>> typically going to figure out on their own. There will be constant
>> questions "if I can invalidate a SwitchPoint, why can't I ask if it
>> has been invalidated?"
> You are right about the questions.  That's one of the first things to annoy me about an API:  mutators w/o queries.
>
> We omitted it because it's not a very trustworthy query.  But it's easy to add.
>
> Here's possible javadoc:
>
>      /**
>       * Determines if this switchpoint is still valid.
>       *<p>
>       * Since invalidation is a global and immediate operation,
>       * this query must be sequenced with any
>       * other threads that could invalidate this switchpoint.
>       * It may therefore be expensive.
>       *<p>
>       * In addition, due to concurrent invalidations by other threads,
>       * a switchpoint may report itself as valid, and yet become
>       * invalid before the querying thread begins to act on the
>       * supposed validity.
>       * @return true if this switchpoint has never been invalidated
>       */
>      public boolean isValid() {...}

As John says,  if isValid return true,
you know nothing because it's perhaps not true anymore.

Rémi



More information about the mlvm-dev mailing list