On Sat, Dec 22, 2001 at 07:47:31PM -0500, Michael G Schwern wrote:
> I've rearranged the proposed features a bit to put the long objections
> at the bottom.
> 
> Brent Dax wrote:
> > I've been thinking about improvements that could be made to Exporter for
> > Perl 6. 
> > 3. Warnings about conflicts:
> >     use warnings 'Exporter';
> >     sub Dumper { ... }
> >     use Data::Dumper qw(Dumper);
> >     #prints out a warning (not just 'redefined subroutine', either).
> 
> This would be nice.  In fact, it could be retrofitted onto perl5's
> Exporter.
> 
> > 4. For modules, saying 'use Exporter' should be enough to get import.
> >    If you don't want Exporter's import(), just C<use Exporter()>.
> 
> Very nice.  Exporter::Lite does just that.

What actually stops us retrofitting that onto perl5's exporter?
put import (or export or some other simple name) into EXPORT_OK for Exporter,
and if Exporter is called to export that function from Exporter's namespace,
it knows it's being requested to act as Exporter for a non-OO caller.

[either by messing with the callers @ISA (documented as doing this) or by
placing a closure into the caller's namespace to act as an OO call to
Exporter::import, or something such like]

What is bad about this, apart from we're creating a new interface that perl6
may not like? [and doing something that perl6 isn't doing is bad enough not
to do it]

Nicholas Clark

Reply via email to