Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-10-07 13:49:21


From: "Paul A Bristow" <pbristow_at_[hidden]>
| From: boost-bounces_at_[hidden]
> | [mailto:boost-bounces_at_[hidden]] On Behalf Of Robert Kawulak
> |
> | I'm considering some changes in naming, in particular:
> |
> | - I'd change 'constrained_type' to 'constrained',
>
> Sounds better IMO.

Agreed, but what is the corresponding namespace name,
"constraineds?" I wonder if constrained_types::constrained would
be acceptable?

> | - I wonder if I should move 'constrained' and its aliases
> | ('boounded_int'
> | etc.) up form 'boost::constrained_types' namespace directly to 'boost'
> | namespace - these are things that are most likely to be used and maybe
> | 'boost' is better for them (or maybe, instead of moving them, using
> | declarations in 'boost' will suffice),
>
> Not sure.

They should not be in the boost namespace. Using directives,
declarations, and aliases can be used when desired. We don't
want to add more to the boost namespace than necessary. Besides,
if you later find that it is desirable, you only need this:

   namespace boost
   {
      using ::boost::constrained_types::constrained;
   }

> | bounds_specifiers::integral_bounds ->
> | bounds_specifiers::integral
> | bounds_specifiers::generated_bounds ->
> | bounds_specifiers::generated
> | bounds_specifiers::static_bounds ->
> | bounds_specifiers::static
>
> Yes, _bounds doesn't add anything. Does the _specifiers add much?
>
> bounds::integral
> bounds::generated
> bounds::fixed

Much better.

> | - OTOH, the bounded policies' names seem to be to short and
> | not properly
> | chosen, I'd change their names so they say what the policy
> | does when an
> | attempt is made to assign an out-of-bounds value:
> |
> | bounded_policies::error -> bounded_policies::failing
> | bounded_policies::wrap -> bounded_policies::wrapping
> | bounded_policies::clip -> bounded_policies::clipping
>
> I think the shorter is still clear - at least it isn't abbreviated.
>
> | - maybe changing the namespaces' names from plural to
> | singular would make
> | the names of policies more meaningful:
> |
> | error_policies::throw_exception ->
> | error_policy::throw_exception
> | bounded_policies::error ->
> | bounded_policy::failing
>
> Yes singular is much better.

How about eliminating the separate namespace?

   constrained_types::error
   constrained_types::wrap
   constrained_types::clip

In use, those would look like this:

   typedef constrained_type<error<bounds::integral...
   typedef constrained_type<wrap<bounds::integral...
   typedef constrained_type<clip<bounds::integral...

The first one doesn't look right to me as it somehow suggests
that the type is an error type (or is wrong!).

How about this variation:

   typedef constrained_type<error_at_boundaries<bounds::integral...
   typedef constrained_type<wrap_at_boundaries<bounds::integral...
   typedef constrained_type<clip_at_boundaries<bounds::integral...

Those are a bit verbose, but are possibly clearer.

Both of those are odd when you still have bounds::*. Maybe this
would work:

   typedef constrained_type<constraint_handling::error<bounds::...
   typedef constrained_type<constraint_handling::wrap<bounds::...
   typedef constrained_type<constraint_handling::clip<bounds::...

> | bounds_specifiers::static_bounds -> bounds_specifier::static
>
> As you noted static is forbidden. local_static is a bit long?
>
> bounds::fixed
>
> perhaps???

I like it. It's easy enough to document that the limits are/must
be compile time constants.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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