Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Why Does Test::Deep Kill Test::Class

by fergal (Chaplain)
on Mar 20, 2009 at 16:45 UTC ( #752112=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Why Does Test::Deep Kill Test::Class
in thread Why Does Test::Deep Kill Test::Class

() would be fine if you didn't then have to type

use Foo::Bar::Woz::Snuts (); Foo::Bar::Woz::Snuts::Wibble($x, $y)

Python gets it right (well better at least) with

from foo.bar.woz import snuts; snuts.wibble(x, y)

and suchlike. This is pretty much impossible in Perl due to symbol table access being absolute, not relative.


Comment on Re^5: Why Does Test::Deep Kill Test::Class
Select or Download Code
Re^6: Why Does Test::Deep Kill Test::Class
by Your Mother (Canon) on Mar 20, 2009 at 18:01 UTC

    You don't if the module does its exporting right, and most do.

    use Foo::Bar::Woz::Snuts qw( Wibble );

    I realize you're talking about having relative spaces in the code though. To me that would add arbitrary levels of (human) ambiguity for the hacker trying to read it. I think this could be solved in Perl too with some export/namespace alias magick but I wouldn't like or use the feature.

      There is no ambiguity in how it's done in python and after 4 years of python, I've never had a problem or even heard a complaint about that. Howver, squishing it into Perl would be hard because you'd have to make it live side-by-side with the currently absolute package names and without introducing new syntax, you would have ambiguity and confusion.

      Python doesn't provide any syntax for addressing packages with using an absolute name. You can do it but by digging around in sys.modules but it's not part of the language as such.

      All that said, I have rarely missed Perl's absolute package scheme when writing python and I have often missed python's relative package scheme when writing Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://752112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2014-11-26 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (171 votes), past polls