Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Using functional abstraction in Perl

by spurperl (Priest)
on Jul 02, 2005 at 09:20 UTC ( [id://471897]=note: print w/replies, xml ) Need Help??


in reply to Re: Using functional abstraction in Perl
in thread Using functional abstraction in Perl

As I said, this can be done with OO. But in many cases OO is less elegant and is an overkill.

In the given example, would an OO solution suit better ? A Java-school person would probably define a class for "variable", a class for "binding" and a class for "bindings", all interrelated. So much complexity and code for such simple a mission.

OO is nice in many situations, but it's not as nice in others. Sometimes the OO technique of "data and the actions taken on it" aren't justified as the data + actions are not as tightly coupled. It is also a leftover from a too strict typesystem, which Perl (like Lisp) fortunately lacks. In Perl a reference can be any data you can imagine. It can be a reference to a scalar, it can be a reference to a HoAoH. Only the functions working on this data know its internal structure. In Java, a class is necessary to define a new type for the data, in Perl there are other (often better) ways.

  • Comment on Re^2: Using functional abstraction in Perl

Log In?
Username:
Password:

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

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

    No recent polls found