On Thu, 2015-08-20 at 15:04 -0400, Andrew Stitcher wrote:
> On Thu, 2015-08-20 at 14:44 -0400, aconway wrote:
> > Here's the API doc, the code is coming. It is like previous 
> > proposals
> > which were well received but more correct. It has *two* conversion
> > types, pn_borrowed_ptr and pn_given_ptr. This both automates the
> > refcounting for smart pointers and acts as "hard" documentation of
> > the
> > ownership rules for plain pointers. Conversion types like this are
> > not
> > a new idea - CORBA used to have something like it.
> > 
> 
> Small linguistic quibble: 
> 
> "given" goes with "lent"
> "taken" goes with "borrowed" (or maybe "owned" is better than 
> "taken"?)
> 

Gahh, I agonized over those names! But you're right dammit!

> (Your suggested names are confused about whether they are from the 
> API
> implementation or client side)

The names are not about the direction but whether there is a transfer
of ownership or not. But of the 4 possible combinations your two are
better than the one I picked.

Lets try something new: pn_transfer_pointer and pn_loan_ptr. I can't
even talk about this without saying "transfer of ownership" constantly
so that seems like a good fit, and "temporary permission to use without
any transfer of ownership" is in fact a "loan".

The big difference is these are nouns. I think the problem with
"borrowed", "owned" etc. is they beg the question "who owns it?", "who
borrowed it?" which is not the question we want people to ask.
"transfer" and "loan" focus attention on the nature of the
*transaction* rather than the participants,  which is what the types
are about.

Using nouns also distinguishes these types from normal pointers that
are named with adjectives (plain, shared, unique, intrusive) which is
good. pn_transfer_ptr and pn_loan_ptr are pointer-like but you don't
use them in your code, and they don't own anything themselves - they
only exists as temporaries that automate how ownership is transferred
(or not) to normal pointers.

I like that a lot better. I hope you do because I'm running out of
ideas :)


Reply via email to