in reply to call external sub ref from method in single line
Last time I checked, ASCII characters were still free. And, last time I checked, computer programmers were not.
Also, most of those programmers are not spending their days writing new code. They are wrestling with existing, revenue-producing code bases (“legacy code”) which might be decades old and worked-on by more than a hundred different people over those years.
Therefore, what’s really most-important in your source code is: clarity. For instance, using a more meaningful name than sub_ref, and maybe deliberately using a local variable (named, say, $ajaxRequestCallback instead of $pSub ...) to clarify to the next guy exactly what it is you’re calling and why. (And if his future modification, written three years after you got smooshed by that most-unfortunate bread truck, needed to call the subroutine twice or under slightly different conditions, your “wasteful” use of a few extra lines or characters will have helped him a little.)
Not meaning to preach here ... (honest) ... but over these years I have just seen so much “cleverness,” and in so many different languages. Clarity and simplicity in the original coding makes a high-dollar difference in the sort of “project turn-around, I See Dead Projects™” work that I do so much of. Speaking therefore as the one who cleans up after you: “Please don’t try to economize on bytes or lines. Ever. Instead, make it as easy as possible for us to read your mind, given that we cannot dig you up to ask.” Thank you. ;-)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: call external sub ref from method in single line
by Laurent_R (Canon) on Oct 05, 2015 at 18:03 UTC | |
by Anonymous Monk on Oct 05, 2015 at 21:55 UTC | |
by 1nickt (Canon) on Oct 06, 2015 at 11:59 UTC | |
by Anonymous Monk on Oct 11, 2015 at 23:53 UTC |