Advanced Perl Programming

Advanced Perl ProgrammingSearch this book
Previous: 7.4 Recap of ConventionsChapter 7
Object-Oriented Programming
Next: 7.6 Resources
 

7.5 Comparison with Other OO Languages

7.5.1 Tcl

The base Tcl library does not have any object-oriented features. It has recently acquired a package construct that provides a namespace for subroutines and global variables (there is no relationship between packages). Tcl is a very malleable language, and several freely available libraries strive to impose an object-oriented structure on the language. A package called stoop provides a pure Tcl solution featuring single and multiple inheritance, dynamic binding, run-time type identification, and so on. Another, called [incr Tcl], is a slightly more ambitious effort and provides a C++-like set of keywords and facilities. incr Tcl requires a patch to Tcl, though.

7.5.2 Python

Python is an excellent language for learning object orientation. (It also happens to be my favorite OO scripting language.) All facilities, including internal data structures such as lists and dictionaries (hash tables) and external libraries have consistent object-oriented interfaces. Python provides a number of hooks for class developers to write different types of accessor methods and supports multiple inheritance. All objects in Python are implemented as hash tables, unlike in Perl, in which you have to choose a representation (or looking at it more optimistically, where you are free to choose the optimal representation).

7.5.3 C++ and Java

There are a number of significant differences between Perl and C++ in their approach to object-orientation.

Much of what has been said of C++ in the above comparison is true of Java too.


Previous: 7.4 Recap of ConventionsAdvanced Perl ProgrammingNext: 7.6 Resources
7.4 Recap of ConventionsBook Index7.6 Resources