On 10 February 2010 22:46, Ovid <publiustemp-perl...@yahoo.com> wrote:
>> From: Fergal Daly <fer...@esatclear.ie>
>
>
>> > Also, some test modules are problematic. For example:
>> >
>> >    use Moose;
>> >    use Test::Deep;
>> >
>> > That gives you a prototype mismatch warning. So you can omit underlying 
>> > modules if needed:
>>
>> This is caused by both modules exporting a blessed function by default
>> and Moose's one sets a prototype.
>
>
> Since the core Scalar::Util::blessed has the same prototype, would you 
> consider adding this to Test::Deep?

Test::Deep::blessed doesn't have the same prototype (it doesn't do the
same thing, although they are related).

Any module that exports anything by default is probably broken but
changing what a module exports after years of use will just break a
load of stuff.

The main reason people do it is because perl makes it a pain if you
don't, requiring you to type Foo::Bar::Buzz::TheThingIWanted or to
declare in advance what symbols to import.

BTW, python gets this right

from Foo.Bar import Buzz
...
Buzz.ThatThingIWanted

no danger of name clashes (you can import Buzz as some other name if
there's another Buzz to import) and when reading the code, you know
where every symbol originates. I started implementing this for Perl so
that you could do

use from Foo::Bar import Buzz;

Buzz->ThatThingIWanted

but it gets too messy because it has to be implemented as methods on
an object or class returned by Buzz() and then you do needs to depend
on whether ThatThingThatIWanted was a function or a class method. If
it was a function, you don't want the fully qualified package as the
first argument, if it's a class method, e.g. a constructor, you do
want to pass that and there's no way to tell. So I gave up.

End of rant :)

F

> Cheers,
> Ovid
>  --
> Buy the book         - http://www.oreilly.com/catalog/perlhks/
> Tech blog            - http://use.perl.org/~Ovid/journal/
> Twitter              - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
>
>
>

Reply via email to