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

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

Thread Previous | Thread Next
Audrey Tang
July 6, 2006 07:41
Re: namespaces, a single colon to separate HLL prefix?
Message ID:

在 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 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.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About