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

Re: Why callbacks?

by exussum0 (Vicar)
on Mar 30, 2007 at 17:51 UTC ( #607553=note: print w/replies, xml ) Need Help??

in reply to Why callbacks?

Callbacks are great for injecting behaviour into something - ruby calls them mixins.

Instead of having variables referenced within the function, outward, to something lexically scoped or globally is really weird. I would expect the callback retaining the data and you querying it for the result. Hrm..

Replies are listed 'Best First'.
Re^2: Why callbacks?
by Joost (Canon) on Mar 30, 2007 at 17:56 UTC
      You can do mixins in Perl as well, by using Exporter to import methods into an OO class. CGI::Application uses this technique to add methods via plugins.
      Right right, was using the wrong terminology for what i meant. tnx.

        Terminology is important, as those are commonly agreed protocols. Ialize that this is not just a problem with Vicar, even other higher type of saints make those mistakes, for example ovid calls a common class a framework.

        Regardless, aimminghigh and use terminologies properly.

Re^2: Why callbacks?
by Cop on Dec 23, 2007 at 19:42 UTC

    Obviously you are looking at this as a coder, not a language designer. There are two purposes (actually only one since those two are one if you can see): 1) Dynamically change or determine the behavior; 2) make it possible for creation of frameworks.

    For example, in a GUI program with callback, rendering engine no longer needs to know how to render a component, the component knows and in way renders itself.

    This might seem abit diificult for you to understand, but try your best to learn.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://607553]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2018-05-21 21:44 GMT
Find Nodes?
    Voting Booth?