|
Posted by Mumia W. on October 2, 2007, 1:17 am
Please log in for more thread options
On 10/01/2007 10:26 PM, bmillares wrote:
> Hi,
>
> I've been working on a module that provides encapsulation, inheritance
> and strong typing. I know there are several OO frameworks already in
> CPAN, but I have not seen any that implements the
the --> those
You meant to say "that implements /those/ OO principles...."
> OO principles that
> strictly. The module I'm proposing will provided private, protected
> and public methods and properties. It will also implement the concept
> of virtual methods, and only methods marked as such can be overridden
> by the children.
>
Bad idea. Methods should be "virtual" by default.
> Another key piece of functionality is that when a method is overridden
> by a child, from the perspective of the parent the method behaves as
> the original method did and the new method or property is only
> available from the child down.
Perl has this already.
> Also private properties and method are
> only visible in the class the implements them and the children are
> free to use the same names without the problem of collisions or
> overriding those entities.
>
> Basically, it would be and OO implementation closer to how it's
> currently implemented in Java or C#,
Why should Perl be Java?
> my hope is that it would make
> folks versed in those languages more comfortable with perl and allow
> perl developer to explore and perhaps even enjoy some of the features
> of those languages.
>
Persons versed in those languages are already accommodated--they have
Java and C#.
> In order to make use of the functionality of the proposed module a
> perl developer would simply have to inherit from the proposed module
> and use function attributes to mark the functions as a properties or
> methods and whether they are private, protected or public. Functions
> marked as properties will be used for defining the property type and
> how to handle gets and set within a tied hash which will be to object
> core structure. Most of the overhead associated with enforcing the
> encapsulation will take place during the CHECK phase and when classes
> are instantiated, from there on they work off dispatch tables which
> should be pretty fast. The biggest benefit would be for those folks
> working under mod_perl as they will compile once and use many times.
>
> Sorry for the rant, but I was wondering if there is any interest out
> there for such a animal. If there is please let me know and I will
> post the module for peer review.
>
> Thanks,
>
> bmillares
>
There may indeed be some interest, but most people interested in strong
typing and enforced encapsulation are using a language other than Perl.
I see no need for Perl to become another language to attract programmers.
However, your efforts may bear fruit. As you develop your class-building
framework, you may consider the functionality in some of these modules:
Class::MethodMaker
Class::Struct
Class::Virtual
Class::Contract
Params::Validate
You will find those modules on CPAN and pre-installed in some Linux
operating systems.
Also look into "inside out classes."
|