Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multimethod dispatch function installation issues

1 view
Skip to first unread message

Dan Sugalski

unread,
Sep 29, 2003, 10:00:09 AM9/29/03
to perl6-i...@perl.org
Okay, here's an issue for everyone. I'm writing the MMD subsystem, at
least the parts needed for operator overloading, and I'm coming across the
need to defer adding functions. For example, the Float class has functions
for the Integer class, and vice versa, and we can't guarantee that both
classes are loaded in when the functions are going to be installed. I
don't want to discard the functions, though, since they should be in force
when both classes are available.

So, I've two options:

1) When one or both of the classes a MMD function is installed for don't
exist, we give them both class numbers (but don't load them) so when the
classes *are* later loaded they already have numbers

2) We put the functions in a 'pending' list and install them when (if) the
missing classes are later loaded

I can see it going either way, and I'm not sure which would be better.
(It's important to note that this is strictly an internal issue, since
bytecode'll never know one way or the other) Opinions?

Dan

Mark A. Biggar

unread,
Sep 29, 2003, 10:25:01 AM9/29/03
to Dan Sugalski, perl6-i...@perl.org
Dan Sugalski wrote:

Isn't there also the option to force load the missing class(es)
recursively?

--
ma...@biggar.org
mark.a...@comcast.net

Dan Sugalski

unread,
Sep 29, 2003, 10:28:25 AM9/29/03
to Mark A. Biggar, perl6-i...@perl.org

We could, but I don't want to do that here. Just because a PMC class
presents functions for other PMC classes doesn't mean we necessarily want
to load those classes--just to have the functions available if those
classes are ultimately loaded. I'd prefer to leave class loading to
explicit "load this class" code, rather than have it implicit. Besides,
it's distinctly possible that many of the functions will be for classes
that aren't even available.

Dan

Nicholas Clark

unread,
Sep 29, 2003, 2:51:02 PM9/29/03
to perl6-i...@perl.org

Also this could cause such a maze of automatically loaded dependencies
that using any class from parrot's supplied builtins would drag in pretty
much every class.

However, would it be possible to schedule the other classes for lazy loading
(à la perl5's AUTOLOAD), so that the functions behave as if they were
defined at the correct time, but actually pull in the needed bulky libraries
only if invoked?

Nicholas Clark

Nicholas Clark

unread,
Sep 29, 2003, 2:54:15 PM9/29/03
to perl6-i...@perl.org
On Mon, Sep 29, 2003 at 10:00:09AM -0400, Dan Sugalski wrote:

> So, I've two options:
>
> 1) When one or both of the classes a MMD function is installed for don't
> exist, we give them both class numbers (but don't load them) so when the
> classes *are* later loaded they already have numbers
>
> 2) We put the functions in a 'pending' list and install them when (if) the
> missing classes are later loaded
>
> I can see it going either way, and I'm not sure which would be better.
> (It's important to note that this is strictly an internal issue, since
> bytecode'll never know one way or the other) Opinions?

Which way uses less RAM?
Which is faster up front?
Which is faster if most of the functions and classes are eventually used?
Which is faster if most functions and classes aren't used
Which is better for a serialisation call while things are only partially
loaded?


I've got no real idea on any of these, apart from a hunch that assigning
numbers to classes that aren't loaded (yet) is going to be needed for
other things.

Nicholas Clark

0 new messages