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 • For scalar methods (and others) it would be nice to have a simple
40 bounds-checking interface to approve or reject (with an exception)
41 new values that were passed in.
42
43 As pointed out by Terrence Brannon, the right interface to adopt is
44 probably that of Attribute::Types:
45
46 use Class::MakeMethods::Standard::Hash (
47 'scalar' => [ 'count' => { TYPE => 'INTEGER' } ],
48 'scalar' => [ 'name' => { TYPE => qr/^[A-Z]\w*$/ } ],
49 'scalar' => [ 'account' => { TYPE => &checksum_account_number } ]
50 );
51
52 • Improve use of _diagnostic hooks for debugging. Add various "(Q)"
53 debug diagnostics.
54
55 • Finish building Inheritable array and object accessors.
56
57 • Finish building Composite::* packages.
58
59 • Resolve DESTROY-time issues with Standard::Inheritable,
60 Composite::Inheritable, and Template::InsideOut.
61
62 • Add slice and splice functionality to Standard::*:hash and
63 Composite::*:hash.
64
66 Template::Generic
67 • Allow untyped object accesors if "class" attribute is not set.
68 (Suggested in Jan-01 NY Perl Seminar discussion.)
69
70 • Standardize naming templates for array, hash, other method types.
71
72 Deprecate verb_x methods? Or at last make them consistently
73 available both ways.
74
75 Make list methods consistent with hash_of_lists methods, in action,
76 and in name (x_verb). Also for others (e.g., set_ clear_ boolean)
77
78 • Should default object template provide auto-create behavior on
79 ->get()?
80
81 • Generalize the "Generic:scalar -init_and_get" interface to support
82 memoizing values for other accessor types.
83
84 • Consider adding hash each and array iterator methods, using a
85 closure to provide iteration.
86
87 • Add support for tied arrays & scalars, a la tiedhash
88
89 • Add string_multiple_index.
90
91 • Extend index methods to support weak indexes with WeakRef. Perhaps
92 just have it accept a hash ref to use as the index, and then allow
93 people to pass in tied hashes?
94
95 • Maybe make private or protected method croak if they were called by
96 a method_init method which was called by an outside package.
97
98 Not entirely clear what the right semantics or security precautions
99 are here...
100
101 Template::Generic Subclasses
102 • Finish building code_or_scalar meta-method.
103
104 • Finish building Class::MakeMethods::ClassInherit subclass.
105
106 Need to work out how to capture changes for non-scalar values. For
107 example, if a subclass inherits an array accessor and then pops it,
108 do they get copy-on-write?
109
110 • Add enumerated string/number type.
111
112 Provide helper methods with map of associated values (ex $o->port =
113 80 ... $o->port_readable eq 'HTTP' ). Cf. code for earlier
114 unpublished 'lookup' method type.
115
116 • For StructBuiltin:
117
118 Add -fatal flag to die if core func returns false / undef Add call
119 method to recall method with alternative arguments. Add -nocall
120 flag to not call core func on new.
121
122 • Replace ClassName:static_hash_classname with Class:indexed_string.
123
124 Template Internals
125 • Figure out which modules, if any, should actually be using
126 AutoLoader. Probably just Template::Generic?
127
128 • Give users a way to do meta-method code-caching in Perl library
129 hierarchy, rather than in /tmp/auto or other user-specified
130 directory..
131
132 Provide mechanism for pre-generating these at install time.
133
134 Perhaps load these via do, rather than open/read/eval?
135
136 Perhaps pre-generate expanded libs with all of the -imports
137 resolved?
138
139 • Support generating code files and loading them as needed.
140
141 This would be similar to Class::Classgen, except that we'd do the
142 generation at run-time the first time it was required, rather than
143 in a separate pass.
144
145 For example, given the following declaration:
146
147 package Foo::Bar;
148 Class::MakeMethods::Template::Hash->import(-codecache=>'auto', scalar=>'foo');
149
150 We should be able to write out the following file:
151
152 cat 'auto/Foo/Bar/methods-line-2.pl'
153 # NOTE: Generated for Foo::Bar by the Class::MakeMethods module.
154 # Changes made here will be lost when Foo::Bar is modified.
155 package Foo::Bar;
156 sub foo {
157 my $self = shift;
158 if ( scalar @_ ) {
159 $self->{'foo'} = shift();
160 }
161 $self->{'foo'}
162 }
163
164 Then on subsequent uses, we can just re-load the generated code:
165
166 require "auto/Foo/Bar/methods-line-2.pl";
167
168 To do this, we need to:
169
170 • Provide an option to select this if desired; maybe ...
171 import('-cache' => 'auto/', ...)?
172
173 • Figure out which directory we can/should write into.
174
175 • Re-evaluate the textual code templates, without generating the
176 closures. Substitute in any _STATIC_ATTR_ values. Make other
177 _ATTR_ values point to some public lookup table or package
178 scalar.
179
180 • Notice if the source file (or Class::MakeMethods modules) has
181 been updated more recently than the generated file.
182
184 See Class::MakeMethods for general information about this distribution.
185
186
187
188perl v5.34.0 2021-07-22 MakeMethods::Docs::ToDo(3)