in reply to Re: [Parrot] Is there a class loader?
in thread [Parrot] Is there a class loader?

> the semantics of Perl-style "modules are packages are classes"

What Perl are you thinking of that has these semantics? In Perl 5 at least, modules are not packages are not classes (are not files)! They can be, of course, but that is by "the typical" convention, and is not close to being enforced like it is in, say, Java. This example breaks all those stipulations:

# client code use NiftySuperPack; whooo("hey"); # exported function my $obj = Nifty->new(); # where did that constructer come from?

# NiftySuperPack.pm # There *is* no package NiftySuperPack! package Nifty::Utils; sub whooo { ... } package Nifty; sub new { ... } { no strict; *{caller() . "::whooo"} = \&Nifty::Utils::whooo; # forced export }

Replies are listed 'Best First'.
Re^3: [Parrot] Is there a class loader?
by rg0now (Chaplain) on Feb 17, 2005 at 14:09 UTC
    > What Perl are you thinking of that has these semantics? In Perl 5 at least, modules are not packages are not classes (are not files)!

    This is perfectly why I wrote: "modules are packages are classes" or something along these lines...:-)

    What I wanted to paraphrase is that there is nothing in Parrot that would enforce the rather exotic object model of Perl5. So, as far as I can tell you, Parrot does not implement an equivalent of %INC, which the OP objected. It is up to the language running on top of Parrot to implement something similar.

    By the way, a nice use of the object system of Parrot can be found in the precious SDL bindings of Parrot. The code lives in $PARROT_ROOT/runtime/parrot/library/SDL.

    rg0now

      I think you are confusing OOP with module loading. %INC has nothing to do with Perl's object model. Perl's object model is not "exotic" so much as it is lean, and thus a large part of it — indeed including the association of module and package with class — is given solely by convention. There is nothing in Perl that enforces the rather exotic object model you think Perl5 has. :-)