Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: [Perl 6] Method call versus function call on a data set

by hossman (Prior)
on May 29, 2007 at 23:19 UTC ( [id://618085]=note: print w/replies, xml ) Need Help??


in reply to [Perl 6] Method call versus function call on a data set

It's a question of intent. If your goal is to ask an object to take the "grep" action on a thingie and give you the result, you use a method call. If your goal is take a specific (global) action "grep" against a thingie and an object which you assume is an array (where the grep action indicates that it will do what it can to make it's argument an array and if it can't it will fail) then you use the function syntax.

Forget "grep" for a moment and imagine i'm providing you a a library that implements a "dothat" function. If you want to execute my "dothat" function against objectA and objectB, you call the funtion. If objectA says that coincidently it has a "dothat" method and you want to ask objectA to "dothat" to objectB you call the method.

  • Comment on Re: [Perl 6] Method call versus function call on a data set

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-25 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found