|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-06-28 06:47:16
"Robert Ramey" <ramey_at_[hidden]> writes:
> David Abrahams wrote:
>> "Robert Ramey" <ramey_at_[hidden]> writes:
>>
>> That's not the best way to fix the problem. Just make sure the
>> functions are declared before use and they will be found with explicit
>> qualification.
>
> That was my first choice - but it conflicted with export.hpp which needed to
> know what types and archives to instanciate serialize for. I found no
> other way to reconcile it.
>
> I'm sure this is not the only case where two phase lookup causes
> problems. Its going to cause lots of problems in working programs
> if it spreads to other compilers. Two phase lookup is a bad idea.
This is extremely troubling. Whether you like it or not, two phase
lookup is part of the language specification, and it's going to
"spread" to other compilers as they get more conformant. Boost
libraries should be designed to work in a way that is consistent with
the language as it is defined, rather than being patched up with the
wrong band-aid when compilers fail to conform to the author's ideal of
non-conformance.
Before you object, I don't think my assessment is unduly harsh: the
consequences of using an unqualified call as you have done have
already bitten one developer and the library change is, IIUC, not even
out the door to the public. Indiscriminate ADL is well-known to cause
this sort of problem, and Boost developers are probably more careful
than most to insulate themselves from it by isolating their types from
functions. It's going to be a much bigger deal once Joe Global
Namespace gets his hands on it.
I don't know much about the needs of export.hpp, but there are
well-known ways to navigate this terrain and I can't believe that the
serialization library is unique in this area. Maybe if you ask for
help and give some detail about what you're trying to do, someone can
suggest a better approach. For example, did you consider using class
template partial specialization?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk