Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-09-27 18:06:08


On 09/27/2005 05:05 PM, Calum Grant wrote:
>
>>-----Original Message-----
>
>
>>[mailto:boost-bounces_at_[hidden]] On Behalf Of Larry Evans
>>
>>>Is there any interest in providing relational containers in Boost?
>>>Are there any features/improvements you can suggest for RML?
>>
>>http://visula.org/relational/implementation.html contains:
>>
>> The reason this has to be a macro is because it needs to work with
>> names, not just types. It was felt that the benefits of
>>being able to
>> write customer.name or customers.name instead of
>>column<1>(customers)
>> or col<1,1>() outweighs the inherent disadvantages of
>>using a macro.
>>
>>why not use an enumerator:
>>
>> column<name>(customers)
>>
>>instead of a number:
>>
>> column<1>(customers)
>>
>>? Would this eliminate the macro need?
>
>
> An early RML did use tuples indexed in the way you describe. I did use
> enums - writing magic numbers is very bad for readibility and
                   ^^^^^^^^^^^^^ I guess you mean an enumeration here?
> maintainability. Personally I prefer to read
>
> customers.name
>
> instead of
>
> column<name>(customers)
>
Well, how about:

       customers.get<name>()

IMO, that's only marginally more verbose and just as readable.

> There is also a big problem with enums - being able to associate the
> correct enum with the correct type. I.e. the "name" column may be 2 for
> customers, and 3 for products. So you really need
> column<customer_name>(customers) and column<product_name>(product).

Or, customers.get<customers::name>()

OK, that's a little less readable :( , but I guess you believe the
disadvantage of macro use is not as bad as the disadvantage of
prefixing customers:: to the enumerator. I'm not that sure.


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