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

What do use and require evaluate to?

Thread Next
Ingo Blechschmidt
July 12, 2005 05:16
What do use and require evaluate to?
Message ID:
what do use and require evaluate to?  
S06 suggests it's probably some kind of Module object:   
  The result of a use statement is a (compile-time) object that also has   
  an .assuming method, allowing the user to bind parameters in all the   
  module's subroutines/methods/etc. simultaneously:   
      (use IO::Logging).assuming(logfile => ".log")   
We could make (use Foo) evaluate to the class object Foo,   
    my $foo = (use Foo).new(...);   
Alternatively, we could go the Perl 5 way and return the   
last thing evaluated in (which might be a Module   
object, assuming that module Foo {...} evaluates to Foo).   
What do successive uses of use and require evaluate to?   
Perl 5 is inconsistent:   
    $ cat >   
    package Foo; 42;   
    $ perl -we 'warn require Foo; warn require Foo'   
    42 at -e line 1.   
    1 at -e line 1.   
I'd like Perl 6's use and require to return the same thing.   
In Perl 5, %INC maps the partial path names of the modules   
loaded to their absolute ones. What should the keys and values   
of %*INC be in Perl 6?   
Linux, the choice of a GNU | self-reference, n. - See self-reference     
generation on a dual AMD   |    
Athlon!                    |    

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