Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

•Re: Re: Perl - Is it an OO Language

by merlyn (Sage)
on Aug 26, 2002 at 18:50 UTC ( [id://192972]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl - Is it an OO Language
in thread Perl - Is it an OO Language

Well, you can do it blindly by encapsulation and delegation. But the "weak at best" is a bit far-reaching here, don't you think?

Perl has a complete set of typical OO-operations available, as long as everyone cooperates.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Re: Perl - Is it an OO Language
by Anonymous Monk on Aug 26, 2002 at 19:18 UTC
    I am speaking of Perl's OO encapsulation being weak, and it is. Yes you can acheive various degrees of encapsulation, but at a cost (or in Damian's words, by turning Perl's flexibility against itself). I think saying that Perl's OO encapsulation is 'weak at best' is a fair statement.

      You keep using the phrase "weak at best". I do not think it means what you think it means.

      Feel free to explain how an enclosed lexical is "weakly" encapsulated. It may not be the most popular way of creating an object property, but it is a deliberate language feature.

        We have mixed meanings happening. My statement was not in reference to how strong an encapsulation we can achieve using various techniques (flyweight, closure, etc), but that Perl's support is weak (if you want it, you'll need to do it yourself and subclassers will need to know your internal implementation details in order to cooperate).
      It isn't weak, it's flexible. It's that simple. You can encapsulate as strongly as you wish. It isn't even all that costly. Bottom line, the language scales, from oneliners to 2,500,000 projects. You pick from the possibilities whatever your current task necessitates. Most people, most of the time, write stuff somewhere close to the oneliner end of the range. Perl's default behaviour is therefor only sensible.

      Makeshifts last the longest.

        It isn't weak, it's flexible. It's that simple

        And C isn't a weak OO language, it's flexible! You have the freedom to build any OO framework you like with C. I'll leave you with a quote from TheDamian's book (page 296):

        Encapsulation is one of the cornerstones of object orientation, but it's the area in which Perl's support for object-oriented programming is the weakest. ..... Fortunately, Perl's flexibility can be turned against itself to provide a means of building objects that respect the encapsulation imposed by their classes.

        And this node for a discussion of (and solution for in followup) how Perl's simple inheritance breaks encapsulation of the superclass. I justify my original comment on the basis that if you need to jump through hoops to get some feature (in this case encapsulation), support for that feature is 'weak'.

Re: •Re: Re: Perl - Is it an OO Language
by John M. Dlugosz (Monsignor) on Aug 27, 2002 at 15:13 UTC
    Is that can in the same vein as "you can write structured if/while/etc code in assembly language."?

    Perl can do a great deal. I think the question is arguing semantics on how much innate support is required to be an OO language.

    My design is object-oriented. It's implemented in Perl. QED?

    —John

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://192972]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-19 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found