develooper Front page | perl.perl6.language | Postings from May 2005

Re: Syntax of using Perl5 modules?

Thread Previous | Thread Next
Dave Whipp
May 25, 2005 09:20
Re: Syntax of using Perl5 modules?
Message ID:
Autrijus Tang wrote:
> So, this now works in Pugs with (with a "env PUGS_EMBED=perl5" build):
>     use Digest--perl5;
>     my $cxt = Digest.SHA1;
>     $cxt.add('Pugs!');
>     # This prints: 66db83c4c3953949a30563141f08a848c4202f7f
>     say $cxt.hexdigest;
> This includes the "" from Perl 5., etc will
> also work.
> Now my question is, is my choice of using the "perl5" namespace indicator a 
> sane way to handle this?  Is it okay for Perl 6 to fallback to using Perl 5
> automatically?  Or should I use something else than "use" entirely?

To my mind, the coupling seems wrong. If the "use" statement needs to 
state the language of the included module, then it would be difficult to 
later re-implement that module in p6.

My understanding is that there are clear rules (see S11) to distinguish 
p5 modules from p6: if the first keyword in the file is "module" or 
"class", then it's p6; otherwise assume p5.

Your use of hyphens puts your "perl5" indicator in the "URI" field 
(again, see S11), which is expected to refer to the author. "perl5" 
doesn't seem correct in this context. Even if you got rid of one of the 
hypthens (so that "perl5" is the "version"), then it still feels wrong. 
Each version of a module should be free to choose its language, but that 
should be encapsulated within the module.

If you do want to impose the language from the "use"er, the I'd expect 
an adverbial syntax: "use:p5 Digest;".


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