in reply to Global Super Class (equivalent of java.lang.Object)

Howdy!

Java and Perl approach things differently. Let's look at the methods Object provides...
JavaPerl
clonenothing standard; depends on object model being used
equals==
finalizeDESTROY
getClassref
hashCoderefaddr
notifynot sure; thread related
notifyAllnot sure; thread related
toString""
waitnot sure; thread related
?UNIVERSAL::can
?UNIVERSAL::isa
?UNIVERSAL::VERSION

As you can see, Java doesn't stuff much into Object, but those things are deemed necessary for every object to be able to do. UNIVERSAL has some introspective methods; the other things that have to be in a class (in Java) are language features, either as operators or built-ins, and are mostly all applicable to non-object-oriented programming as well as OO.

If your project has some "universal" things that all the objects need to do, then by all means define a base class for all of your objects. That lets you make your system behave the way you need it to while not (potentially) breaking it for code you include from elsewhere.

yours,
Michael
  • Comment on Re: Global Super Class (equivalent of java.lang.Object)