4 ms·
Sometimes copy paste is unavoidable, but a lot of times it can be replaced with a loop over a constructed array of "things that change" that achieves the same g
by Spoom 12y ago
Sometimes copy paste is unavoidable, but a lot of times it can be replaced with a loop over a constructed array of "things that change" that achieves the same goal. I've been trying to do this recently in the spirit of DRY; it has the side benefit of often making the code quite a bit more readable.
- earljwagner 12y agoYes, and sometimes you want to loop over something that can't be expressed with existing syntax. That's the benefit of Lisp-style macros: http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html
- astrobe_ 12y agoI find it ironic that we use programming editors that are extremely good at copy-pasting (vi, emacs for instance) only to avoid using those features because we know they are somewhat evil (introduce those kind of bugs, "prevent" proper factoring).