ext_86378 ([identity profile] khedron.livejournal.com) wrote in [personal profile] topaz 2008-03-10 04:31 pm (UTC)

Is the ability to pass a function/reference to a function a desirable trait?

I always thought of that as one of those arcane things that C and C-like languages let you do to shoot yourself in the foot and several other body parts...and/or to ensure you have a job forever because that critical piece of code you wrote is completely unintelligible to anyone but you, and if they fire you the entire company will go up in flames of spaghetti.


I responded to this a bit below already, but Java OO code uses interfaces for (mostly) the same reasons that C would let you pass function pointers. There are situations where it's better to figure out what the right thing to do is during run time, not at compile time.

Post a comment in response:

(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org