From e8527c229122b5e2f8ae581f3716bc99a5fd3118 Mon Sep 17 00:00:00 2001 From: Carl Masak Date: Wed, 29 Sep 2010 07:51:17 +0200 Subject: [PATCH 1/2] [S09] be more clear about what's an error Two of the three examples marked with "Error" turned out to actually be logical maybe-not-what-I-meant errors. Marked them as such. --- S09-data.pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/S09-data.pod b/S09-data.pod index 0a4ba5dd2..fcad94d9f 100644 --- a/S09-data.pod +++ b/S09-data.pod @@ -207,8 +207,8 @@ specification, but "unspace" is allowed: Note that the square brackets are a compile-time declarator, not a run-time operator, so you can't use the "dotted" form either: - my @values.[10]; # Error - my @keys\ .[10]; # Error + my @values.[10]; # An indexing, not a fixed-size declaration + my @keys\ .[10]; # Ditto Attempting to access an index outside an array's defined range will fail: From 58fe2d8c12892ab2cb661b4477fcd75f0bef67f4 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Wed, 29 Sep 2010 22:06:28 +0200 Subject: [PATCH 2/2] [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