5 ms·
Correct me if I'm wrong but I believe that the straightforward option is that the tools that perform concatenation handle this as well. Are there any downsides
by schmrz 14y ago
Correct me if I'm wrong but I believe that the straightforward option is that the tools that perform concatenation handle this as well. Are there any downsides to this approach?
- gilini 14y agoCreation of an empty statement and dissemination of "superstitious programming", as I like to call it.
- lhorie 14y agoTechnically speaking no, but socially speaking yes. You wouldn't want your code base made entirely out of code golfing that works through miraculous twists and bends. By the same logic, you should prefer even small aspects of your code to be clear to a junior developer (or even yourself a year from now), rather than overly clever and packed with several layers of obscure knowledge in a single character.
- schmrz 14y agoI completely agree, that's why I'm saying that it shouldn't be in the codebase. It should be handled by external tools that are performing the concatenation. Of course that begs the question if this is necessary at all since I personally haven't seen it used but I haven't read the source of many JavaScript projects either.
- lhorie 14y agoI'm of the opinion that the behavior of code shouldn't be changing depending on what tool you pass it through. If down the road your homebrew concatenation script gets replaced by, say, a minification tool that does concats, but no ASI defensive code, then your code might break. Besides, you don't necessarily want all files to be automatedly wrapped in a function. jQuery for example would break.