From 58fe2d8c12892ab2cb661b4477fcd75f0bef67f4 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Wed, 29 Sep 2010 22:06:28 +0200 Subject: [PATCH] [S12] spec setting and getting values of attributes by means of introspection After lengthy IRC discussion, we concluded that it's a good idea to provide some form of introspection that doesn't bother about perceived privacy borders, provided that the implementation makes it feasible. Also clean up some wording. --- S12-objects.pod | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/S12-objects.pod b/S12-objects.pod index cd2507da5..6a4ed9afd 100644 --- a/S12-objects.pod +++ b/S12-objects.pod @@ -2227,8 +2227,8 @@ world (the class already knows its own structure, after all), a set of C methods are presented to be a single C method. You need to use C<.candidates> on that to break it down further. -The C<.^attributes> method returns a list of attribute descriptors -that have traits like these: +The C<.^attributes> method returns a list of C objects +that have methods like these: name type @@ -2238,8 +2238,21 @@ that have traits like these: has-accessor build readonly + get_value($obj) + set_value($obj, $new_value) -It also takes the parameters: +Note that an C is not tied to a particular object of a type, but +rather to the type itself. Which is why C and C need to +receive the actual object as first positional parameter. + +[Conjecture: if it's not feasible for a meta class or a representation to +implement C and C, it may die with an helpful error +message when these methods are called.] + +C and C violate the perceived privateness of attributes, +and thus should be used with care, and at the user's own risk. + +C<.^attributes> It also takes the parameters: :local only methods defined in the current class :local($n) out $n levels