|
Boost : |
From: Matthew Austern (austern_at_[hidden])
Date: 2000-11-01 16:47:53
David Abrahams wrote:
> > Thanks for the update. (I hope the idea of hijacking names in
> > every namespace met a suitable fate.)
>
> Some thought it was patently obvious that it was disallowed (and thus not an
> issue in the first place), but I think the general consensus was that such
> hijacking is illegal. Whether or not it is considered a defect that we do
> not say so is still in question. In particular, the specification for
> valarray seems to clearly imply that Koenig lookup /should/ be used in some
> cases. So I think there are some fuzzy edges on this one and we're not
> exactly sure what the appropriate resolution in the standard is.
I think it was unanimous that overloading a standard library function f
should, in general, not affect the behavior of a standard library function
g whose documentation doesn't even mention f. Allowing this is a library
bug.
I'm putting in so many qualifications because some people thought that
hijacking should be allowed in more restricted cases. There was not
general agreement about what those restricted cases should be, or whether
there should be any. Among people who thought that hijacking should
sometimes be permitted, here are some of the cases that I heard mentioned
as possible candidates:
- swap. Many people believed that swap is a special case.
- any function in a context where it's explicitly mentioned in the
standard. If the standard says that a function g calls f, then it
should be taken to mean unqualified f rather than std::f.
- Fundamental mathematical functions like sin() or cos(), either in
all contexts, in the context of valarray and complex only, or in
the context of valarray only.
--Matt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk