Talk:Callback (computer programming): Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 34:
== Callbacks > Polymorphism?? ==
I don't agree with this passage:
":A callback can be used as a simpler alternative to polymorphism and generic programming, in that the exact behavior of a function can be dynamically determined by passing different (yet compatible) function pointers or handles to the lower-level function."
That's at least misleading. It sounds like it's advocating using function pointers rather than polymorphism because "the exact behavior of a function can be dynamically determined by passing different ... function pointers". Polymorphism and generic programming can do the same thing (at least as well, IMHO). You might be able to argue that function pointers are simpler, buy anyone who has tried to use them in C++ knows that (1) the syntax is horrific and (2) using member function pointers for callbacks is a nightmare. By the way, it may be worth mentioning boost::function somewhere in the article, which is a superb library that uses generic programming to make function pointer-like objects which can be used very effectively for callbacks.