develooper Front page | perl.perl6.language | Postings from July 2006

Re: namespaces, a single colon to separate HLL prefix?

Thread Previous | Thread Next
From:
Aaron Sherman
Date:
July 6, 2006 12:39
Subject:
Re: namespaces, a single colon to separate HLL prefix?
Message ID:
1152214700.28796.276.camel@pps
On Thu, 2006-07-06 at 09:09 -0700, Larry Wall wrote:
> On Thu, Jul 06, 2006 at 10:40:21AM -0400, Audrey Tang wrote:
> : The : form is approved and canonical (line 303, the Modules spec, aka  
> : S11.pm version 14).
> : 
> :     use perl5:DBI;
[...]
> :     my $dbh = perl5:DBI; # currently parsed as perl5(:DBI)
> : 
> : but we can say that for each HLL-qualified module name, it's a single  
> : token and is therefore recognized first.
> : 
> : Does that sound sane?  If yes, S11 can be updated to reflect that.
> 
> It's only sane if we require the predeclaration of the language higher
> in the lexical scope.

Namespaces aren't your only concern here. You also care about all of the
semantics of module loading and the integration of the target language's
module loading semantics with Perl 6's. For example, there's a
completely separate search path for Perl 5 modules, and an implicit
invocation of a package method that might not happen in P6. I think what
you want to be saying is not, "use DBI from the Perl 5 namespace", but
"invoke the Perl 6 / Perl 5 module loader interface for DBI".

That's really something like:

        use Lang::Perl5::Loader;
        perl5use DBI;

That we provide a shortcut called "use perl5:DBI" is just sugar, and we
might provide that for many languages. However, the user should know how
to do it the "hard way" in case they want to talk to a less officially
blessed language:

        use Lang::Bash::Loader;
        use Lang::Elisp::Loader;
        bashuse "~/.bashrc";
        elispuse "hanoi";
        say %*ENV{PATH}
        hanoi(13);

Inventing syntactic sugar for the back-end case probably doesn't buy you
anything special.

-- 
Aaron Sherman <ajs@ajs.com>
Senior Systems Engineer and Toolsmith
"We had some good machines, but they don't work no more." -Shriekback



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About