在 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, AudreyThread Previous | Thread Next