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

After rereading PPD15, the only thing I can think of is that Parrot does not force the semantics of Perl-style "modules are packages are classes" (or something along these lines). It will leave the registration of the files being loaded to the actual language, if the language happens to want to implement a feature like that.

So there is a nice class-loader in Parrot (since you could not instantiate two classes), but classes are not automatically associated with files. Hope this makes sense...

rg0now

Replies are listed 'Best First'.
Re^2: [Parrot] Is there a class loader?
by gaal (Parson) on Feb 17, 2005 at 13:25 UTC
    > 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 }
      > 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. :-)
Re^2: [Parrot] Is there a class loader?
by Thilosophy (Curate) on Feb 18, 2005 at 00:33 UTC
    It will leave the registration of the files being loaded to the actual language, if the language happens to want to implement a feature like that.

    I think one goal of Parrot is to allow using code written in many different languages (Perl5, Perl6, Python, Ruby) simultaneously. This seems to imply that classes created in these languages are interoperable (by adhering to the standards layed down in PDD15), and that Parrot should provide the mechanism to load and register them.

    Thus, I am assuming that "keeping track of %INC" will eventually be handled by Parrot, but how exactly is not yet specified. Is that it?