Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-06-18 18:31:05

> [Ed Brey]
> The nested namespace is quite convenient. However the namespace name
> "tuples" should be "tuple". (Better reflects its usage at a given
> in a program; it's similar to giving an enum a singular name. Also
> provides better correspondence to the header file name.)
> [Gary]
> I thought the use of tuple::tuple than tuples::tuple would be more
> confusing, especially if the user did a
> using namespace tuple;
> In general I find it easier to read code that has namespaces that are
> different names from the class names.

[Ed Brey]
Aaargh. Using the plural is out of sync with other namespaces and such
constructs I've come across, but your concern seems quite valid. I know
that Python tends to have namespaces (in the form of modules) with
functions by the same name. Is there any wisdom to be gleened from
experience in that corner?
Sorry, We don't mean to cause you any anguish. But will bow to the wisdom of
practice. Dave A. do you have a comment here?

[Ed Brey]
I'm a little confused about your point regarding the "using namespace
boost::tuple" use case. That seems to be the one place where there
would be no confusion, since after that tuple uniquely means the class,
whereas boost::tuple means the namespace, and the potentially
odd-looking tuple::tuple would never be needed.

Perhaps since the namespace here is nested under boost, rather than ::,
difficulties with identically named class and namespaces won't occur in
this case.
Well it drives me nuts reading it. So I'm pushing for a different

> [Ed Brey]
> set_left and set_right seem likely to cause problems with
> (and top-to-bottom?) languages. set_open and set_close would probably
> be better.
> [Gary]
> Hmm, I'm unfamiliar with this conflict. Are there any other comments
> this?

[Ed Brey]
Just to clarify, the function names assume that the opening bracket of
the tuple will naturally be displayed on the left portion of the line.
In all the languages I've ever studied (English, French, Latin), this is
the case. However, I understand that there are other languages
(Arabic?) where one normally reads from right to left, and so the
opening bracket would be on the right side of the line. Of course, the
interface names are in English, but if it's easy to save a programmer
some mental reversals, one might as well if alternative names are
equally clear.
Thanks for the clarification. Jaakko and I will talk it over and let you

> [Ed Brey]
> nil is undocumented. It should probably be either documented or moved
> into the detail namespace. Is the nil/null being proposed as due to
> function library discussion compatible with this? Assuming yes, it
> would seem to keep things minimal to share the single class once it is
> complete. As far as naming goes, null is standard C/C++ terminology
> this concept of referencing nothing when one might otherwise be
> referencing something, and it would be good to use the existing name
> this concept. This is especially true if a C++ 0x might have a null
> keyword that could be leveraged by simply deleting the null class. If
> null keyword would not be drop-in replacement, then it makes sense to
> call the class something besides null (e.g. nil) to avoid a future
> conflict.
> [Gary]
> This got discussed to death on Function, with no resolution yet.
Tuples can
> use the Function version just fine and that is what I've proposed we
do. Yet
> there seems to be some hesitancy to letting function add it without
> review. If we could add it soon, I'd be glad to hold off putting
tuples up
> until this is resolved (I'm hoping soon, as in the next review?) But I
> want to wait 6 months on this.

[Ed Brey]
As long as it is in the detail namespace and avoids possible name
conflicts (nil for Mac and null for future C++ keyword (is the latter a
real concern?), I can't see any problems.
Well "nil" is out for all the MacOS reasons. John posted another alternative
and I wouldn't mind that either.

> [Ed Brey]
> Documentation:
> "Using the library":
> It is unclear whether tuple.cpp is needed for tuples in general, or
> if tuple input and output operators are used.
> [Gary]
> Just the I/O streams.
[Ed Brey]
I deduced that from the code. My point was that the documentation
should make the fact more clear.

> [Ed Brey]
> 'tuple<X,X,X>(string("Jaba"), string("Daba"), string("Duu"))' would be
> stronger example as 'tuple<X,X,X>("Jaba", "Daba", "Duu")' (assuming
> that's OK).
> [Gary]
> Hmm.. I'm not sure what you mean by this. How so?
[Ed Brey]
tuple<X,X,X>("Jaba", "Daba", "Duu") demonstrates that implicit
conversion of the arguments is supported.
Ahhh. Ok.

Thanks again for all your very constructive comments.



Boost list run by bdawes at, gregod at, cpdaniel at, john at