---------- Forwarded message ----------
From: Matias Capeletto
On 2/15/07, Ion GaztaƱaga
wrote: Hello everyone,
The review of the proposed Boost Bimap library written by Matias Capeletto starts today (February 15th, 2007) and ends after 10 days (February 25, 2007).
Hi Gottlob,
So far: A: namespace: ---------------------
from the 'One Minute Tutorial':
That is more or less all that is needed to start using the bidirectional map. The following two lines must also be added:
#include
using namespace bimap; 2 points: - I prefer not to use 'using'. I know I don't have to, but I don't like that the docs imply that I do.
Ok, the "must" in the docs is maybe to strong. I can reword that.
more importantly: - is it going to be in 'bimap' or in 'boost'?
We have to put everything inside a namespace, I do not want to pollute the boost namespace.
B: 'relation' ----------------
I think I understand the philosophical reasoning for preferring 'left/right' over 'first/second', and thus the impetuous for creating 'relation'. However...
Two issues to talk about here. 1) The new notation left/right used instead of first/second. 2) A new name for 'relation'. We have to introduce the new notation. In the context of maps, the notation first/second is used in places where the first element has different meaning than the second one. left/right is symmetrical and implies that both sides are at the same level, that there is no special side.This is the key point to grasp. This is explained here: http://cablemodem.fibertel.com.ar/mcape/boost/libs/bimap/boost_bimap/the_tut...
- I think 'relation' is too generic a word to abscond.
From the dictionary: "A logical or natural association between two or more things" I like 'relation'. But we can talk about other names.
- how about: - couple - duo
The thing is that these words are very similar to "pair" and the idea is to mark the difference.
- or probably just 'bipair'
That was my original choice. 'relation' sounds better to me but let see what other people think about this.
- or maybe even consider that std::pair, although not perfect, might make things easier:
Using left/right instead of first/second is an important design decision. Here is where things start mixing up.
- it can be used in other algorithms
The new notation is used in very different contexts. The algorithms written for first/second has no sense in the contexts where left/right are used. If you want to use algorithms that works with map/pair notation you have to pass one of the side views to it.
- it is already well known
That is true and in the context of maps it have a very established meaning different from what we want to express with left/right. This is a point for the new notation.
- the nature of typing code forces order - ie note that bimap
is different than bimap (although philosophically the same).
(Side Note: Using tags they are exactly the same.)
Even with 'left/right' you still have order - left corresponds to the *first* type listed in the bimap, 'right' corresponds to the *second* type passed in. Or is it bimap
? I don't think so.
You still have order. The important thing to understand is that we are not looking to eliminate that order. We want to express that the two things are equally important.
But other than that, so far so good. Looks like something I'd use. And the docs are snazzy.
Thanks! Matias