Aryeh Gregor <Simetrical+wikilist <at> gmail.com> writes:
>
> At the very least, newlines should be preserved, so you can get a line
> number when an error occurs.  Stripping other whitespace and comments
> is probably actually be worth the performance gain, from what I've
> heard, annoying though it may occasionally be.  Stripping newlines is
> surely not worth the added debugging pain, on the other hand.
> (Couldn't you even make up for it by stripping semicolons?)

Stripping semicolons is dangerous, see e.g.
http://stackoverflow.com/questions/444080/do-you-recommend-using-semicolons-after-every-statement-in-javascript/1169596#1169596
(not to mention you would have to differentiate between statement separators and
argument separators in for constructs)

I agree though that the small bandwidth gain of stripping newlines is not worth
the pain. Even if minification can be turned off manually, it would make user
reports near useless, and some javascript errors are not easy to reproduce.

Combining files has a negative side effect too: since errors stop thread
execution, once something breaks, everything breaks (without combining,
execution would have continued on the next file). This could be mitigated
somewhat by wrapping code sections in try-catch blocks (syntax errors cannot be
caught, but anything else can).


_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to