mop problem 3 - class, extends, and method keyword should be independent from mop
mop provide class, extends, and method keyword to perl. but I think these keyword should be independent from mop because these keyword is useful for non-mop modules.
I opposite only mop use these keywords. I hope these keyword is used for other modules the keywords need.
For example, current hash based module is rewrite in the following way.
Before:
package Point3D; use Object::Simple -base => 'Point';has z => 1;
sub clear {
my $self = shift;
...
}
After:
use Object::Simple::Syntax;class Point3D extends Point {
has x => 1;method clear {
...
}
}
I think class, extends, and method keyword is not for only meta-object protocol. I think these keyword should be designed for hash-based object.
Hash based object is current perl major implementation of Object-Oriented program. New syntax should help hash based object, not only mop.
I think the argument against making
class
,extends
, andmethod
work outside mop would be:Once mop is in core, why would you want to write any object-oriented code without using mop?
There are certainly valid answers to that, such as, I need to support Perl 5.8.x. But if you need to support Perl 5.8.x, then you can't use any new keywords (such as
class
,extends
, andmethod
) introduced in Perl 5.2x.y anyway.>Once mop is in core, why would you want to write any object-oriented code without using mop?
Because I don't think mop is best answer.
I think mop have many problems. I think inside-out object don't fit current perl object system.
I want syntax to write easily current perl object system at first.
The current prototype (#3) is separating the syntax and the mop itself.
Also, we dropped the inside-out thing, now it is going to be an opaque C pointer.