From: Fernando Cacciola \(Office\) (fcacciola_at_[hidden])
Date: 2002-10-23 14:59:16
----- Original Message -----
From: "Guillaume Melquiond" <gmelquio_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Wednesday, October 23, 2002 3:45 PM
Subject: Re: [boost] two_pi or pi_twice?
> On Wed, 23 Oct 2002, Fernando Cacciola wrote:
> > > Or should it be the Interval library convention that puts the constant
> > > name first - an obvious plus point when making ordered lists - all the
> > > pi constants will come together.
> > >
> > > [details snipped]
> > >
> > FWIW, my own constants use *exactly* (word by word I think) the naming
> > convention you proposed.
> Would it be surprising if I said I prefer the way the constants in
> the Interval library are named? :)
> More seriously, I prefer using a sort of Polish inverse notation in order
> to have the main term in front of the name. For example, I think it's more
> homogeneous to have
This is what I expected... I figured that the Interval Library names came
from that notation.
> rather than
I agree there is merit in the reverse notation... having the 'base' name
first is nice.
The problems I see are:
(a) the syntax for 'correct' postfix wordings is typically longer, and
That is, I prefer 'two' over 'twice', 'four' over 'four_times', etc..
(b) correct postfix wording is not always available, so many times you have
to put a word that should go in front of the noun right after it, which
'pi_sqrt' (means sqrt(pi): sqrt_pi)
'pi_twice_minus' (means -2*pi: minus_two_pi)
> > > And while I am seeking views on names, do the following seem sensible:
> > >
> > > Explicit typed names
> > >
> > > pi_f // float
> > > pi_d // double
> > > pi_l // long double or pi_l ??
> > > // Potential ambiguity of long int and long double here!
> > > // C standard ISO 9899:1999 (a.k.a. C99) choses _l for long double
> > > pi_i // integer
> > > pi_li // long integer // or pi_l conflists with C99 ??
> > >
> > What about unsigned constants?
> Does that exist? The only unsigned constants that I can think of are the
> upper limits of the unsigned integral types. And I don't think the
> Constants library has to provide them.
I was not considering which type of constants actually existed. I was
thinking about possible combinations.
Even if there are no unsigned constants, I still prefer to separate basic
type (fp or int) from size-modifier.
> > I'd rather use a 'type + (optional) modifier' postfix scheme:
> > type:
> > f=floating point
> > i=integral
> > modifiers:
> > s=short
> > l=long
> > u=unsigned
> > pi_fs (float)
> > pi_f (double)
> > pi_fl (long double)
> > pi_i (int)
> > pi_il (long int)
> > pi_iu (unsigned int)
> If you already have 'pi_i', there is no need for 'pi_iu', is it?
Right, I was just typing combinatorily...didn't think about the actual
> > > Interval limit static const constant variable names - add _l and _u
> > >
> > These will be easely confused with the 'type' postfix.
> > I'd use prefix instead:
> > lower_pi_fl
> > higher_pi_fl
> I don't know if it's better to have long name. But I'm sure I wouldn't go
> for a prefix notation.
Because of the reverse notation scheme right?
> And I would also use suffixes with the same length:
> Please note that 'lower' and 'upper' are the words used to refer to the
> bounds of an interval in the Interval library and I think it wouldn't be a
> bad idea to use the same notation in the two libraries.
Hmmm... My mind just neglected the word 'upper' to me :-)
I really tried to find an opposite for lower with the same word length, but
upper didn't pop up in my head.
...it's too early to be this sleepy!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk