in reply to Irony of import

Anyone know the original rationale for this? For such a linguistically sensitive language as Perl, I'm surprised. Unless it came out of the flirtation with indirect object syntax:

Makes perfect sense to me. You see "Exporter" in the place where you define the things you want to put in somebody else's name space. You see "import" in the place where you want to put the things. Two different sides of the same operation.

Replies are listed 'Best First'.
Re^2: Irony of import
by xdg (Monsignor) on Aug 22, 2005 at 14:10 UTC

    Except that if you want to customize the export, you don't use Exporter and write an "import" function instead. I grok it, but that's because I'm used to it -- it just struck me suddenly as kind of funny.

    If designing from first principles, I'd be more inclined to have the builtin "importing" function (aka use) call a module's "export" function. That way, the function name is a command. "When I want to import, I tell it to export."

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      If designing from first principles, I'd be more inclined to have the builtin "importing" function (aka use) call a module's "export" function. That way, the function name is a command. "When I want to import, I tell it to export."

      And then you'll have somebody come along and ask "why when I add stuff to my symbol table do I call export - surely I'm importing stuff?" :-)

      You can argue it either way.