Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: [Perl 6] Method call versus function call on a data set by hossman
in thread [Perl 6] Method call versus function call on a data set by vrk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-03-28 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found