3 ms·
There's no reason to list every single little tip ('use inject instead of an external accumulator') somewhere since I wouldn't expect a beginner to read through
by mechanical_fish 17y ago
There's no reason to list every single little tip ('use inject instead of an external accumulator') somewhere since I wouldn't expect a beginner to read through all that anyway.
They might not read it on day one. But they will find themselves reading it via Google after they read a line of code (written, perhaps, by a respected Rubyist) that uses inject and are trying to figure out how the idiom works and where it should be used.
And, if they're lucky and they've found some fairly clear and concise docs, they might bookmark that page, or even read the rest of the page while they're there, thus saving themselves anywhere from 20 to 100 future trips to Stack Overflow. ("What is this thing with the hash that we use to pass options? What is this oddball "names.map(&:upcase)" syntax? What does "class << self" mean? How come my colleagues laugh bitterly when I try to use Rails fixtures?")
- benofsky 17y agoMy point exactly.