Bryan C. Warnock: # On Saturday 22 December 2001 02:29 am, Brent Dax wrote: # > I've been thinking about improvements that could be made to # Exporter for # > Perl 6. # > # > 1. Choosing where to export to: # > use Data::Dumper 'Dumper' => 'dumpvar'; # > #exports Data::Dumper::Dumper to Main::dumpvar # (or whatever) # # Where to import to. It's probably not a good idea to export # into someone # else's namespace. (Pull vs Push).
Ack, I hate terminology bugs. Import to. As for someone else's namespace, under the current implementation (*bursts out laughing*) that don't work too well anyway. # > 2. Built-in switch handling: # > use Data::Dumper ('Dumper' : qw(+Indent=2 +Useqq)); # > #imports Dumper, sets $Data::Dumper::Indent=2, and # > # does $Data::Dumper::Useqq is true # # Is it more or less confusing (overall) to be mixing # importation with simple, # non-imported data initialization, as opposed to having it all # be imported # (with optional data initialization)? There are already modules that do things like this. For example: use CGI '-debug'; I'm just building that capability into Exporter. The other possibility I can think of for it is like: use Data::Dumper : '-Useqq'; #on no Data::Dumper : '-Useqq'; #off Except that will try to do Data::Dumper::import('Data::Dumper' : '-Useqq'), unless we special case use/no. Ack. Maybe we can just mix switches and non-switches: use Data::Dumper qw(Dumper -Useqq); Should work, I suppose. BTW, can we genericize 'use' to work like an indirect-object method? use Data::Dumper; Data::Dumper.use; #same thing # > 3. Warnings about conflicts: # > use warnings 'Exporter'; # > sub Dumper { ... } # > use Data::Dumper qw(Dumper); # > #prints out a warning (not just 'redefined # subroutine', either). # > 4. For modules, saying 'use Exporter' should be enough # to get import. # > If you don't want Exporter's import(), just C<use # Exporter()>. # > 5. In addition to @EXPORT/@EXPORT_OK/%EXPORT_TAGS, # provide a way to do # > it on the 'use Exporter' line. # > # > So, with those requirements and what knowledge of Perl 6 I have, I # > present a preliminary Exporter. I typed it directly into # the mailer, so # > there's a good chance of mistakes. If anyone spots any # mistakes in it, # > let me know. # # Well, I can't get it to run.... :-) Darn, I was hoping you had brought a Perl 6 binary back from the future... :^) Still, can you give it a once-over and tell me if you notice anything? --Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 "Nothing important happened today." --George III of England's diary entry for 4-Jul-1776