# New Ticket Created by  "Alek Storm" 
# Please include the string:  [perl #41619]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41619 >


This patch adds the add_attr, rem_attr, and rem_attr_str vtable
methods.  These will come in handy for Ruby's metaclasses or
Smalltalk's class objects.  The only PMC currently affected by this is
ParrotClass, and the rem_attr and rem_attr_str methods are still
unimplemented.

Files affected:
src/ops/object.ops
src/pmc/parrotclass.pmc
vtable.tbl

Thanks,
Alek Storm
diff -u -r --exclude=Makefile --exclude=.svn parrot.clean/src/ops/object.ops parrot2/src/ops/object.ops
--- src/ops/object.ops	2007-02-16 15:42:29.000000000 +0000
+++ src/ops/object.ops	2007-02-25 16:45:54.000000000 +0000
@@ -460,7 +460,7 @@
 =cut
 
 inline op addattribute(invar PMC, in STR) :object_classes {
-    Parrot_add_attribute(interp, $1, $2);
+    VTABLE_add_attr(interp, $1, $2);
     goto NEXT();
 }
 
diff -u -r --exclude=Makefile --exclude=.svn parrot.clean/src/pmc/parrotclass.pmc parrot2/src/pmc/parrotclass.pmc
--- src/pmc/parrotclass.pmc	2007-02-16 15:42:30.000000000 +0000
+++ src/pmc/parrotclass.pmc	2007-02-25 16:51:21.000000000 +0000
@@ -145,7 +145,19 @@
         return SELF->vtable->whoami;
     }
 
+/*
+
+=item C<void add_attr(STRING* name)>
+
+Add attribute named C<name>.
+
+=cut
+
+*/
 
+    void add_attr(STRING* name) {
+        Parrot_add_attribute(interp, SELF, name);
+    }
 
 /*
 
diff -u -r --exclude=Makefile --exclude=.svn parrot.clean/vtable.tbl parrot2/vtable.tbl
--- vtable.tbl	2007-02-16 15:42:42.000000000 +0000
+++ vtable.tbl	2007-02-25 17:03:47.000000000 +0000
@@ -343,6 +343,10 @@
 
 PMC* subclass(PMC* name)
 
+void add_attr(STRING* idx)
+void rem_attr(INTVAL idx)
+void rem_attr_str(STRING* idx)
+
 PMC* get_attr(INTVAL idx)
 PMC* get_attr_str(STRING* idx)
 void set_attr(INTVAL idx, PMC* value) :write

Reply via email to