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

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

Thread Previous | Thread Next
From:
Audrey Tang
Date:
July 6, 2006 07:41
Subject:
Re: namespaces, a single colon to separate HLL prefix?
Message ID:
9951FF21-4A29-4097-9478-7BC41437CB3A@audreyt.org

在 2006/7/6 上午 3:30 時,Allison Randal 寫到:

> Quick question, is there a syntax specified in Perl 6 for referring  
> to namespaces from other languages?
>
> I'm reviewing the namespaces PDD and want to update this snippet:
> ------
> IMPLEMENTATION EXAMPLES: Suppose a Perl program were to import some  
> Tcl module with an import pattern of ``c*'' -- something that might  
> be expressed in Perl 6 as use tcl:Some::Module 'c*'. This operation  
> would import all the commands that start with 'c' from the given  
> Tcl namespace into the current Perl namespace. This is so because,  
> regardless of whether 'c*' is a Perl 6 style export pattern, it is  
> a valid Tcl export pattern.
>
> {XXX - Is the ':' for HLL approved or just proposed? Somebody  
> familiar with Perl 6 please fix the example in the preceding  
> paragraph to use the currently planned syntax for importing modules  
> from other languages.}
> ------

The : form is approved and canonical (line 303, the Modules spec, aka  
S11.pm version 14).

     use perl5:DBI;

However, currently it's only available at use/require line.   
Afterwards, the user simply say:

     my $dbh = DBI.connect(...);

Though I think this:

     my $dbh = perl5:DBI.connect(...)

can be made to work, as it's currently parsefail, thought there is a  
marginal case:

     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.

Thanks,
Audrey
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