Boost logo

Boost :

Subject: Re: [boost] [constrained_value] Constrained Value review results
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-10-08 12:31:36


Robert Kawulak wrote:
> 2010/10/8 Stewart, Robert <Robert.Stewart_at_[hidden]>:
>
> > I see the bounds as being applied at compile time, so it is
> > bound to the specified range at compile time, so, yes, I
> > meant the past participle of the infinitive "to bind." That
> > the bounds continue to apply at runtime after having been
> > bound at compile time is not, I think, the principle
> > distinction.
>
> But applying fixed bounds at compile time is not a defining
> characteristic of "bounded_int", it is using compile time
> constant expressions to specify the bounds.

I fail to understand the distinction you wish to make. The two
sound alike to me. (Also note that I never referenced your
"bounded_int" in my discussion.)

Let me clarify something that has just occurred to me. I've been
writing strictly in the abstract about a compile time bounded
type and a runtime bounded type and about names for them. I've
not been making any specific references to your types as they now
exist.

> >> > ct_bounded<int>
> >> > rt_bounded<short>
> >>
> >> The former is the subset of the latter, so "rt_bounded" is
> >> not a good idea since it may represent objects with
> >> compile-time-fixed bounds as well. I think just "bounded" is
> >> the best.

Here I think you're trying to map "rt_bounded" to your "bounded"
and "ct_bounded" to your "bounded_int" which is restrictive. See
more below.

> > Strictly speaking, runtime bounded is not a superset of
> > compile time bounded, because one cannot choose to do either
> > with the runtime bounded class, right?
> [...]
> > Thus, "bounded" is insufficient for the runtime version as
> > that name implies both categories and does not clearly
> > suggest the runtime variability.
>
> I'm not trying to say that runtime bounded is a superset of compile
> time bounded, but that "bounded" is a superset of "bounded_int".

Here's an example of where we're talking past one another. I'm
discussing the word "bounded" as not being sufficient to indicate
a type with runtime specified bounds.

> You can use "bounded" with static or dynamic bounds.

As a reference to your class template, "bounded" does apply to
both types of bounds. However, the word "bounded" is
insufficient in my mind; it includes both types of bounded types.
I think there should be two distinct names for the two types of
bounded values.

> There are even cases when "bounded_int" cannot be used to
> define static bounds and you have to use "bounded" instead
> these are all the cases where the bounds cannot be expressed
> directly using compile time constant expressions, e.g. for
> floats or rational numbers. See the example with rational
> numbers in the second part of this subsection:
> <http://tinyurl.com/332vmf5#constrained_value.tutorial.compile_time_fixed_bounds>

In which case the type cannot be compile time bound and a runtime
bound type must be used. I see no problem here.

Making things specific, I'd like to see your bounded class
template be an implementation detail with two public types that
use it to do the heavy lifting. (If you think that is
insufficient for some reason, then expose all three with your
current bounded class template being documented as the advanced
form.)

> 2010/10/8 Thorsten Ottosen <nesotto_at_[hidden]>:
> > What about namespaces?
> >
> > boost::constrained_values::run_time_bounds::bounded<int>
> > boost::constrained_values::compile_time_bounds::bounded<int>
> >
> > ?
> >
> > Or
> >
> > boost::constrained_values::static_bounds::bounded<int>
> > boost::constrained_values::dynamic_bounds::bounded<int>
> >
> > ?
>
> Ditto.

I dislike that idea because one must type the scope resolved name
to disambiguate and seeing "bounded" in code is insufficient; one
must find using directives/declarations in the context to know
which type "bounded" references.

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

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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