|
Class::MakeMethods::Template::ToDo - Ideas, problems, and suggestions |
Class::MakeMethods::Template::ToDo - Ideas, problems, and suggestions
There are lots of things that could be done to improve Class::MakeMethods::Template and its subclasses.
class attribute is not set.
(Suggested in Jan-01 NY Perl Seminar discussion.)
Deprecate verb_x methods? Or at last make them consistently available both ways.
Make list methods consistent with hash_of_lists methods, in action, and in name (x_verb). Also for others (e.g., set_ clear_ boolean)
sub foo : lvalue {
my $self = shift;
$self->{foo};
}
Not entirely clear what the right semantics are here...
Need to work out how to capture changes for non-scalar values. For example, if a subclass inherits an array accessor and then pops it, do they get copy-on-write?
Use %FIELDS rather than array of slot names.
Provide helper methods with map of associated values (ex $o->port = 80 ... $o->port_readable eq 'HTTP' ). Cf. code for earlier unpublished 'lookup' method type.
Add -fatal flag to die if core func returns false / undef Add call method to recall method with alternative arguments. Add -nocall flag to not call core func on new.
Provide mechanism for pre-generating these at install time.
Perhaps load these via do, rather than open/read/eval?
Perhaps pre-generate expanded libs with all of the -imports resolved?
This would be similar to Class::Classgen, except that we'd do the generation at run-time the first time it was required, rather than in a separate pass.
For example, given the following declaration:
package Foo::Bar; Class::MakeMethods::Hash->import(-codecache=>'auto', scalar=>'foo');
We should be able to write out the following file:
cat 'auto/Foo/Bar/methods-line-2.pl'
# NOTE: Generated for Foo::Bar by the Class::MakeMethods module.
# Changes made here will be lost when Foo::Bar is modified.
package Foo::Bar;
sub foo {
my $self = shift;
if ( scalar @_ ) {
$self->{'foo'} = shift();
}
$self->{'foo'}
}
Then on subsequent uses, we can just re-load the generated code:
require "auto/Foo/Bar/methods-line-2.pl";
To do this, we need to:
See the Class::MakeMethods manpage for an overview of the method-generation framework.
See the Class::MakeMethods::Template manpage for an overview of the code-generation subclass.
See the Class::MakeMethods::Template::ReadMe manpage for distribution, installation, version and support information.
|
Class::MakeMethods::Template::ToDo - Ideas, problems, and suggestions |