I used all of this features, and felt a sense of freedom that you only get with perl.
Actually you get it with lots of other languages too :-) Java is a very restrictive language (by design). Try playing with Self, Smalltalk, Ruby, Lisp, Python, etc. and you'll find lots of similar benefits.
Learn more languages. More languages good :-)
To demonstrate why this is important sometimes, think of Java's SecurityManager class: It controlls all activities in the JVM including file and inter-thread actions. If one could add and override functions in that class freely, that class would be useless.
Remember - this is only as secure as the JVM itself. If you can compromise this you don't have any real security.
Is there such a way?
You can use techniques like inside out objects, lexically scoped anonymous subroutines, etc. to get similar levels of encapsulation in Perl.
Are there any other downsides (and upsides) that I am not aware of?
Another downside is in creating extensible classes. It is easy to write a class in Perl that can be accidentally broken by a subclass, or have a sub-class that is broken by a private implementation change in a super class.
There are, of course, ways to code around this given sufficient discipline, but it's harder than it should be. As ever it looks like Perl 6 will solve all of these problems ;-)
In reply to Re: OOPerl isn't that bad after all...
by adrianh
in thread OOPerl isn't that bad after all...
by yosefm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |