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

Re: syntax for accessing multiple versions of a module

Thread Previous | Thread Next
From:
Nate Wiger
Date:
October 19, 2005 13:30
Subject:
Re: syntax for accessing multiple versions of a module
Message ID:
4356ACCF.6070904@sun.com
Stevan Little wrote:
> Nicholas,
> 
> This is addressed in S11, here is a link:
> 
>   http://search.cpan.org/~ingy/Perl6-Bible/lib/Perl6/Bible/S11.pod
> 
> To summarize, the syntax to load the modules is:
> 
>   use Dog-1.2.1;
> 
> While the syntax to create a specific version of a module is:
> 
>   my Dog-1.3.4-cpan:JRANDOM $spot .= new("woof");

I'd really like to see a more extensible syntax for this. So:

    use Dog 1.2.1;	# ala Perl5

And then to extend:

    use Dog { version => 1.2.1, cpanid => 'JRANDOM' };

This would allow arbitrary specifications, ie:

    use Dog { interface => 0.2,
              version => ['>=', 1.2.1],
              company => 'Sun Microsystems'
            };

> I addresses the class creation syntax partially in the initial  version 
> of the Metamodel prototype, which was built in p5. I  basically just 
> aliased the package with the long name (%{"Dog-1.3.4- cpan:JRANDOM::"} = 
> %{"Dog::"}). However this does no good for loading  of modules.

Building off the above:

    %{Dog}{1.2.1}{JRANDOM}

Or some such, with the longest-matching object winning.

-Nate

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