|Welcome to the Monastery|
Re^9: I want you to convince me to learn Perlby BrowserUk (Pope)
|on Sep 26, 2013 at 09:02 UTC||Need Help??|
e evenly obvious, although there is still no comment?
First, almost a side-issue here, but an important one. My personal take on comments is expressed at length here and here; but can be summarised by saying that I think that for the most part comments in source code are a counter-productive waste of time, energy, resources and therefore, money.
That said, in the isolated form, I find your self-documenting code a highly readable, fine attempt at the art.
But ... it only works because it is in isolation of a context.
For example, prepend_yearmonth() requires to close over %months. In a short script, the hash might be a package global and declared above the declaration of the subroutines; the actual sort is part of the package level code and everything's hunky-dory.
But now put the sort inside a subroutine -- say, part of the logic of an object's method call. And the hash being referenced by the sort is a part of that object's instance data. Now there is simply no way to define those utility subs to close over the required reference hash.
And that's the crux of the problem that anonymous lambda's address. They allow the programmer to define callback code in the context of its use, thus availing it of access to everything that is in scope at that point. Named-subroutines cannot do this -- in Perl at least -- because any closures used by subs declared in a nested context will result in the infamous:
If you feel it is necessary to (self)document the use pattern of the GRT -- and I can make a strong case that it is better for programmers to learn the pattern than to have it hidden from them -- then I would perhaps suggest something along the lines of:
The key points of this are:
Of course, it is also substantially slower and little more than a pair of 'active comments'; which leaves me believing that the simple addition of a couple of comments achieves the same thing:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.