A patch is attached, but it bears a little discussion.
Methods in pie-thon are stored as attributes. Methods in pirate are
stored as properties. I'm not clear on what the difference is, and
which should be used.
In neither case are methods stored as methods, and this would prevent
other languages which expect to invoke methods on Python objects from
doing so - at least without this patch. This patch allows properties to
be transparently accessed as methods.
I'm also of the belief that getprop and/or getattribute should also be
inheritable. My initial testing indicates that getprop is not
currently. Before providing a patch, I'd like some reassurance that
this assumption is correct.
I have a set of classes and changes I'd like to see get into the Parrot
cvs sooner or later. In fact, I'd prefer if it were sooner as
maintaining what effectively is a separate branch is getting tiresome.
You can see all the changes at [1] or [2]. It is mostly new files, but
for the files that have changed, both the full source and current diffs
are provided.
With these changes, and with the corresponding changes to Pirate [3],
all non-skipped Parrot and Pirate tests will pass, with the exception of
the getprop test mentioned above.
I've also posted more thoughts and background at [4].
- Sam Ruby
[1] http://intertwingly.net/stories/2004/11/09/parrot/
[2] http://intertwingly.net/stories/2004/11/09/parrot.tgz
[3] http://intertwingly.net/stories/2004/11/09/pirate/
[4] http://www.intertwingly.net/blog/2004/11/09/Python-vs-Parrot
Index: src/objects.c
===
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.123
diff -u -u -r1.123 objects.c
--- src/objects.c 3 Nov 2004 14:29:58 - 1.123
+++ src/objects.c 9 Nov 2004 15:41:07 -
@@ -1212,7 +1212,6 @@
STRING *isa;
UINTVAL start;
INTVAL pos;
-find_in_pmc:
class_name = class-vtable-whoami;
method = Parrot_find_global(interpreter,
@@ -1287,7 +1286,7 @@
class = curclass;
if (class-vtable-base_type == enum_class_delegate)
break;
-goto find_in_pmc;
+return VTABLE_find_method(interpreter, curclass, method_name);
}
method = Parrot_find_global(interpreter,
VTABLE_get_string(interpreter,