Comparison with Other OO Languages
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.
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).
C++ and Java
There are a number of significant differences between Perl and C++ in their approach to object-orientation.
Object structure. C++ requires you ...
Get Advanced Perl Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.