I believe that they are now strictly equivalent, although that was not
the case half a year ago.  Back when handles held UUID's, then a
handle could be a null pointer, but holding a valid UUID.  and
vice-versa -- a pointer could be non-null, but the UUID invalid.
Resolving the one form into the other was complicated -- this
confusion was one of the strong motivators for removing UUID's from
the handle.

Getting rid of h.is_defined() and Handle::UNDEFINED seems reasonable.

There's some other obsolete code as well: stuff that is marked with
DEPRECATED_ATOMSPACE_CALLS also should be cleaned up. Currently I
think its only the pattern miner that still uses these.  Its been 5+
years now that these have been deprecated...

-- Linas



On Thu, Jan 19, 2017 at 2:20 AM, 'Nil Geisweiller' via opencog
<[email protected]> wrote:
> Hi,
>
> we have multiple ways to test whether a Handle is valid. I've encountered
> the followings
>
> 1. if (h) then ...
>
> 2. if (h != nullptr) then ...
>
> 3. if (h.is_defined()) then ...
>
> 4. if (h != Handle::UNDEFINED) then ...
>
> there might be more but that's the ones I can recall.
>
> First question: Are they all strictly equivalent?
>
> Second question: can we agree on a canonical way to do that and stick with
> it?
>
> Since `if (h)` is the shortest I would suggest to go with that, but there
> might be reasons to go with something else, like more long term reasons,
> etc.
>
> I'll update the wikipage with the conclusion of this thread. Thanks for you
> help.
>
> Nil
>
> --
> You received this message because you are subscribed to the Google Groups
> "opencog" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/a171e4aa-c840-6ac5-94ac-64be9174d087%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/opencog/CAHrUA36t7LGD0f2D6CLxTPJqLYoE%2B8QLha5TN-yfaFB51rOPMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to