Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-08-01 15:31:15


Ed Brey wrote:

> I gathered as much. That can be fine for concept names like Koenig
> lookup (and only major concepts at that), but rarely appropriate for a
> programatic name.

        Brief history: the original problem was that

        std::cout << 1 << std::endl;

didn't work: you'd have to write

        std::operator<<(std::operator<< (std::cout,1),std::endl);

and it was Andrew Koenig who suggested that this problem could be fixed
by looking for operators in the namespace in which the type of the
arguments of an operator were defined.

        Subsequently, a related problem arose in templates:

        template<class T> void f() {
                T t;
                g(t); // how is g found?
        }

and here the only work around would be to pass all such functions
to the template explicitly. Several people advocated using the
same dependent name lookup mechanism as for operators, and
as usual I was a fairly vocal advocate, and continually refered to
it as 'Koenig' lookup.

        The final phase was the adoption of Koenig lookup
as a completely general mechanism for all unqualified names,
the final convincing argument being that it
solved an outstanding problem with friend injection
(although the solution was not entirely backwards compatible,
impacting Barton and Nackmans well known trick).

        I'm not sure how Andrew feels about this
honour, but the name has stuck. What started out as an
ingenious solution to an isolated by vexing problem
subsequently solved at least two others. There's a touch
of genius here, and the honour, if any is attached, is
well deserved.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden] 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix  http://felix.sourceforge.net
Literate Programming tool Interscript     
http://Interscript.sourceforge.net

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