On Oct 1, 2004, at 5:45 AM, Leopold Toetsch wrote:

Jens Rieks <[EMAIL PROTECTED]> wrote:
On Friday 01 October 2004 08:42, Leopold Toetsch wrote:
sucks a lot less than making python programmers say
"import Foo.ns.Bar.scalar.baz"

But OTOH I can imagine that finally standard modules are present in Parrot that do the right thing.
E.g. in Python


  import os

would import a Parrot module that wraps these functions to Parrot. So
basically, when you have:

  os.setsid()      # Python
  POSIX::setsid(); # Perl

these two functions would be the same, living in some Parrot lib and
aliased to the language's equivalent.

So the import or use syntax shouldn't be changed just to accomodate
Parrot's namespace internals.

Well, it wouldn't be a syntax "change" per-se, and it wouldn't be to accommodate Parrot--this is about language crossing.


You'd say, in Python, "import Perl.ns.Foo.ns.Bar.scalar.baz" only in the case where the namespaces you are dealing with are of Perl origin. This is Python accommodating Perl (or really, Perl accommodating Python). Perl has more structure to its namespaces than Python does--that's just a fact, and this is one way to deal with it.

In your example above, it looks like you're talking about one function, ostensibly living in two namespaces. That's fine--if you author a module in pasm (no HLL involved), then you get to structure your namespace any way you want. In this case, it sounds like you'd want your module to implement two different interfaces, one intended for Perl, and one intended for Python. That would be fine, and it would be optimal for both languages--at the cost of extra work for the module implementor, explicitly taking into account multiple languages. In the case of someone just writing a module in Perl, not thinking about other languages at all, the compiler will create a Perl-style interface for its namespace, and Python programmers will still be able to use this module, just with a somewhat odd-looking interface. But this isn't a new syntax for Python--from a Python perspective, that really is the structure of that module. It will just look like Perl programmers create really nested modules.

JEff



Reply via email to