Before we release any of the C++ stuff into the wild, we need to nail  
down how to declare namespaces. There are two contenders:

cdef extern from "foo.h" namespace Foo.Bar:
     int f(int)

cdef extern from "foo.h" namespace "Foo::Bar":
     int f(int)

Now one thing I've realized since starting to look at this is  
namespaces can be more than just dotted Python identifiers, e.g. one  
has "std::vector<T>::iterator." Ideally, this will be handled more  
cleanly once we have cpp class nesting, but there's no way to declare  
it now (without resorting to the strings hacking that one does for C++  
currently). I'm leaning towards the latter.

Also, I've been thinking about namespace conflicts. Suppose one has  
A::B::x and Y::Z::x, then we don't provide a way to use both (short of  
resting to string cnames). We could allow

cdef extern from "..." namespace A.B as X:
     int x(int)

or

cdef extern from "..." namespace "A::B" as X:
     int x(int)

print X.x(5)

Would the former with no as clause automatically inject A.B (I'd  
rather not)? This is a non-issue if we go with the latter syntax.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to