1MakeMethods::Docs::ToDoU(s3e)r Contributed Perl DocumentaMtaikoenMethods::Docs::ToDo(3)
2
3
4
6 Class::MakeMethods::Docs::ToDo - Ideas, problems, and suggestions
7
9 There are lots of things that could be done to improve this module.
10
12 Issues about the distribution and supporting files, rather than the
13 code:
14
15 Documentation
16 • Make sure that the documentation is broken up into appropriately-
17 sized chunks, and that people will know which section to look at.
18
19 • As user questions arrive, add the answers as documentation points
20 or examples.
21
22 • Assemble annotated examples and tutorials, and either link to or
23 distribute them.
24
25 • Finish overhauling Template documentation.
26
27 • Include Global and InsideOut uses in the EXAMPLES section
28
29 • Template Internals: Finish documenting disk-based meta-method code-
30 caching.
31
32 Tests
33 • Use Devel::Coverage to measure test coverage, and fill in missing
34 cases.
35
36 • Finish tests for Standard and Composite modules.
37
39 • It does not appear to be possible to assign subroutine names to
40 closures within Perl. As a result, debugging output from Carp and
41 similar sources will show all generated methods as "ANON()" rather
42 than "YourClass::methodname()".
43
44 UPDATE: There now seem to be fixes for this which should be
45 integrated: See the new Sub::Name module and
46 http://perlmonks.org/index.pl?node_id=304883
47
48 • For scalar methods (and others) it would be nice to have a simple
49 bounds-checking interface to approve or reject (with an exception)
50 new values that were passed in.
51
52 As pointed out by Terrence Brannon, the right interface to adopt is
53 probably that of Attribute::Types:
54
55 use Class::MakeMethods::Standard::Hash (
56 'scalar' => [ 'count' => { TYPE => 'INTEGER' } ],
57 'scalar' => [ 'name' => { TYPE => qr/^[A-Z]\w*$/ } ],
58 'scalar' => [ 'account' => { TYPE => &checksum_account_number } ]
59 );
60
61 • Improve use of _diagnostic hooks for debugging. Add various "(Q)"
62 debug diagnostics.
63
64 • Finish building Inheritable array and object accessors.
65
66 • Finish building Composite::* packages.
67
68 • Resolve DESTROY-time issues with Standard::Inheritable,
69 Composite::Inheritable, and Template::InsideOut.
70
71 • Add slice and splice functionality to Standard::*:hash and
72 Composite::*:hash.
73
75 Template::Generic
76 • Allow untyped object accesors if "class" attribute is not set.
77 (Suggested in Jan-01 NY Perl Seminar discussion.)
78
79 • Standardize naming templates for array, hash, other method types.
80
81 Deprecate verb_x methods? Or at last make them consistently
82 available both ways.
83
84 Make list methods consistent with hash_of_lists methods, in action,
85 and in name (x_verb). Also for others (e.g., set_ clear_ boolean)
86
87 • Should default object template provide auto-create behavior on
88 ->get()?
89
90 • Generalize the "Generic:scalar -init_and_get" interface to support
91 memoizing values for other accessor types.
92
93 • Consider adding hash each and array iterator methods, using a
94 closure to provide iteration.
95
96 • Add support for tied arrays & scalars, a la tiedhash
97
98 • Add string_multiple_index.
99
100 • Extend index methods to support weak indexes with WeakRef. Perhaps
101 just have it accept a hash ref to use as the index, and then allow
102 people to pass in tied hashes?
103
104 • Maybe make private or protected method croak if they were called by
105 a method_init method which was called by an outside package.
106
107 Not entirely clear what the right semantics or security precautions
108 are here...
109
110 Template::Generic Subclasses
111 • Finish building code_or_scalar meta-method.
112
113 • Finish building Class::MakeMethods::ClassInherit subclass.
114
115 Need to work out how to capture changes for non-scalar values. For
116 example, if a subclass inherits an array accessor and then pops it,
117 is there some way to provide them with copy-on-write?
118
119 • Add enumerated string/number type.
120
121 Provide helper methods with map of associated values (ex $o->port =
122 80 ... $o->port_readable eq 'HTTP' ). Cf. code for earlier
123 unpublished 'lookup' method type.
124
125 • For StructBuiltin:
126
127 Add -fatal flag to die if core func returns false / undef Add call
128 method to recall method with alternative arguments. Add -nocall
129 flag to not call core func on new.
130
131 • Replace ClassName:static_hash_classname with Class:indexed_string.
132
133 Template Internals
134 • Figure out which modules, if any, should actually be using
135 AutoLoader. Probably just Template::Generic?
136
137 • Give users a way to do meta-method code-caching in Perl library
138 hierarchy, rather than in /tmp/auto or other user-specified
139 directory..
140
141 Provide mechanism for pre-generating these at install time.
142
143 Perhaps load these via do, rather than open/read/eval?
144
145 Perhaps pre-generate expanded libs with all of the -imports
146 resolved?
147
148 • Support generating code files and loading them as needed.
149
150 This would be similar to Class::Classgen, except that we'd do the
151 generation at run-time the first time it was required, rather than
152 in a separate pass.
153
154 For example, given the following declaration:
155
156 package Foo::Bar;
157 Class::MakeMethods::Template::Hash->import(-codecache=>'auto', scalar=>'foo');
158
159 We should be able to write out the following file:
160
161 cat 'auto/Foo/Bar/methods-line-2.pl'
162 # NOTE: Generated for Foo::Bar by the Class::MakeMethods module.
163 # Changes made here will be lost when Foo::Bar is modified.
164 package Foo::Bar;
165 sub foo {
166 my $self = shift;
167 if ( scalar @_ ) {
168 $self->{'foo'} = shift();
169 }
170 $self->{'foo'}
171 }
172
173 Then on subsequent uses, we can just re-load the generated code:
174
175 require "auto/Foo/Bar/methods-line-2.pl";
176
177 To do this, we need to:
178
179 • Provide an option to select this if desired; maybe ...
180 import('-cache' => 'auto/', ...)?
181
182 • Figure out which directory we can/should write into.
183
184 • Re-evaluate the textual code templates, without generating the
185 closures. Substitute in any _STATIC_ATTR_ values. Make other
186 _ATTR_ values point to some public lookup table or package
187 scalar.
188
189 • Notice if the source file (or Class::MakeMethods modules) has
190 been updated more recently than the generated file.
191
193 See Class::MakeMethods for general information about this distribution.
194
195
196
197perl v5.38.0 2023-07-20 MakeMethods::Docs::ToDo(3)