hostilefork / hoist

Strong Source Identity Library for C++
http://hoist.hostilefork.com
Boost Software License 1.0
5 stars 0 forks source link

What return result should non-boolean hopefullyXXX calls have? #7

Open hostilefork opened 10 years ago

hostilefork commented 10 years ago

The question of what these hopefully routines should return is in the air right now. I would like it to be possible that a hopefully call would go hit a database, and possibly say "that's one we can ignore...". But when I think about pointer constructs, like:

ptr1 = hopefullyNotNull(ptr2, HERE)

I wonder if a boolean result might not be as good as returning the pointer that was passed in. Similar logic could apply to tracked<T>::hopefullyAlter - might it be more useful if the code continues execution to have the new (or old) value?

For the moment I'm making all hopefullys return true if their hope was met, and fase if it wasn't. Some routines that take codeplace parameters but return values I've made end as xxxHopefully instead of hopefullyXXX and return results.

hostilefork commented 10 years ago

Note this question applies to the newly-included hoist::hopefullyAlter functions in hopefully.h as well.