Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
allow find-method to be inherited
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sam Ruby  
View profile  
 More options Nov 9 2004, 11:05 am
Newsgroups: perl.perl6.internals
From: ru...@intertwingly.net (Sam Ruby)
Date: Tue, 09 Nov 2004 11:05:47 -0500
Local: Tues, Nov 9 2004 11:05 am
Subject: [PATCH] allow find-method to be inherited

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

[ objects.diff 1K ]
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 -0000       1.123
+++ src/objects.c       9 Nov 2004 15:41:07 -0000
@@ -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,


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Ruby  
View profile  
 More options Nov 14 2004, 7:42 pm
Newsgroups: perl.perl6.internals
From: ru...@intertwingly.net (Sam Ruby)
Date: Sun, 14 Nov 2004 19:42:19 -0500
Local: Sun, Nov 14 2004 7:42 pm
Subject: Re: [PATCH] allow find-method to be inherited

Sam Ruby wrote:
> A patch is attached, but it bears a little discussion.

Well, that didn't exactly work.  I've since commmitted these patches,
and more.  A the moment, all the python and pirate unit tests pass.  (Woot!)

In the absense of other direction, I plan to write more tests and use
them to drive the evolution of object.c and related sources.  A
description of my current thinking can be found at[1], but I am open to
any implementation which continues to pass the tests that I define.  In
fact, the unit tests can change, as long as alternatives are provided
that I can build upon to get the desired functionallity as defined by
the pirate tests.

Now that dynclasses build as a part of the 'all' target, I'm planning on
adding the dynclass tests to the 'test' target.  I've noticed that the
test target is not successful unless the all target had been built
previously, so this should not be a problem.  If anybody has an issue
with this then perhaps a 'testall' target can be defined.

- Sam Ruby

[1] http://www.intertwingly.net/blog/2004/11/14/Parrot-classes


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google