in reply to Re: use slack;
in thread use slack;
In the example that he started with, I prefer looking up the correct function in a hash to scanning a list for it. YMMV. But the two wins I see are that you don't have to synchronize the name of the function with the name of the element in the list, and you don't get cow-orkers tempted to drop the scan and just jump to the function if it exists. (Which takes you from a safe use of symbolic references to a potentially very dangerous one.)
Also the conceptual step of knowing that you can keep functions in a hash is (in my eyes) a worthwhile step forward in sophistication.
|
---|