Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-11-17 16:13:37


From: "David Abrahams" <dave_at_[hidden]>
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
> > * shared_*_cast will be renamed to sp_*_cast.
>
> Why? Without rationale, this seems like a gratuitous change,
> especailly since "sp" doesn't mean much to me.

The idea is to use sp_*_cast as a consistent generic syntax for smart
pointer casts. The shared_*_cast names are too coupled to shared_ptr.

> > * use_count_is_zero will be renamed to bad_weak_ptr.
>
> Why? Is a weak_ptr that doesn't refer to anything "bad"?

In the particular context, yes. :-)

> In the standard, at least, "bad_cast" refers to an operation, rather
> than an object.

I considered a range of names, starting from your earlier
dangling_weak_reference suggestion. I replaced 'dangling' with 'bad' since
standard exceptions tend to use the bad_ prefix; I see that Doug has adopted
the same convention with bad_function_call. The transition from
bad_weak_reference to bad_weak_ptr seemed rather obvious.

The other option was to put 'expired' somewhere in the name since there is
weak_ptr::expired(). I considered 'weak_ptr_has_expired' and
'reference_has_expired' but bad_weak_ptr looks better to me.

Naming decisions are hard, aren't they.

Another change that I'm considering is to drop weak_ptr::get(), and by
implication, operator== and operator<. None of my projects use them although
no doubt the Real World(tm) will object.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk