|
Boost : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2006-04-14 13:18:50
David Abrahams wrote:
> "Fred Bertsch" <fred.bertsch_at_[hidden]> writes:
>
>> I think it would be reasonably safe, however, if you put the
>> argument identifiers in a separate namespace. I like that idea. It's
>> potentially ugly, but it should be considerably safer.
>
> Normally the keyword objects should be declared in a nested namespace
> of the one that declares functions whose parameters they identify, and
> that should generally be a different namespace from that of the
> functions that use those keyword objects. However, it's idiomatic to
> bring those keywords in via using directives to make them available
> without qualification.
Hi,
I got used to using key objects and have grown to like them
a lot (not only for boost.parameter, see phoenix local variables
for example http://tinyurl.com/3mn6w). I typically place such
key objects in a particular namespace and bring them in through
the using directives. True, the keys that are hoisted through the
using directive tend to clash with function arguments (and member
variables) since they are typically named similarly (e.g. length,
size, width). Sure, you can qualify them to avoid ambiguity
(e.g. tags::length, tags::size), but it's not as pretty.
Recently, I've been toying with the idea of using a different
naming convention for keyword objects to alleviate the situation.
Here's an example where I use capitalized CamelCase for keyword
objects:
foo((Length=10, Width=200))
Just a thought...
Regards,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk