4 ms·
Semicolon.js
- carbocation 15y agoIf you made it this far, consider taking a look at palish's operational response ( http://news.ycombinator.com/item?id=3843339 http://news.ycombinator.com/item?id=3843339 ) to the @DouglasCrockford/JSMin vs @fat/Bootstrap brouhaha ( http://news.ycombinator.com/item?id=3842713 http://news.ycombinator.com/item?id=3842713 )
- thezilch 15y agoI checked it out; it's as broken as these childish acts from "reputable" javascript-library maintainers. cat foo.js; jsmin <foo.js "foo" && !"foo" "foo"&&;!"foo"
- palish 15y agoI have a simple fix. Standby. EDIT: Fixed. Thanks for pointing that out. Let me know if you find anything else.
- thezilch 15y agoSure thing; still some edges -- not limited to the following. cat foo.js; jsmin <foo.js var foo = "foo", is_foo = foo? !!foo: "bar"; var foo="foo",is_foo=foo?;!!foo:"bar";
- palish 15y agoFixed. Thank you, keep 'em coming. As of now, semicolon substitution isn't performed if the character before the newline is any of: & | + - * ? :
- thezilch 15y agoLike I said, not limited; surely you can see where these are going... cat foo.js; jsmin <foo.js foo = [ !"foo", !"foo" % !!"bar", 1 == !"foo" ]; foo=[;!"foo",;!"foo"%;!!"bar",1==;!"foo"];
- palish 15y agoFixed. Thanks so much! I added % and = to the blacklist. I'm searching for a fundamentally elegant solution. My current one is more of a kludge... though, if it fixes all cases and doesn't introduce problems, then maybe it's worth a few extra lines.
- thezilch 15y agoThe last example demonstrated more than the % and = punctuators failing your lexer, and then it doesn't demonstrate still more that would remain, including but not limited to... cat foo.js; jsmin <foo.js while( !true){true;} while(;!true){true;} You might look through the token(izing) section of the ECMA's spec, specifically puctuators. http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf http://www.ecma-international.org/publications/files/ECMA-ST...
- palish 15y agoThe "prior character blacklist" is now: & | + - * ? : % = ( [ { , Currently hunting for more problems, and a more elegant solution... Offtopic, the reason I did this JSMin fork was just to challenge myself, not to make a political statement or anything like that. My cat was just diagnosed with feline lukemia. I know this project is a little silly, but it's been fantastic for keeping my mind off of real-world stuff. You're awesome for providing all of these examples; thank you. More usefully, this serves to prove that Mr. Crockford was likely correct in his assessment.
- thezilch 15y agoAlso, consider non-punctuator issues; such as those with exposed reserved-keywords. cat foo.js; jsmin <foo.js do !!1 && 2 while(0) do;!!1&&2 while(0)
- deleted 15y ago[deleted]
- walrus 15y agoVapor.js is making fun of the trend of JavaScript frameworks. Most of the existing frameworks advertise their file size, since a small size is desirable for fast page loads. Vapor.js is an empty file. Recently the authors of a popular JavaScript/CSS framework, Bootstrap, decided to remove the semicolons from their JavaScript (since they're technically optional). Douglas Crockford is the author of a tool called JSMin that compresses JavaScript files. He is known ot have strong opinions on JavaScript coding style, as is evident in his book JavaScript: The Good Parts and his JavaScript formatting/checking tool, JSLint. Someone pointed out that now that Bootstrap no longer has semicolons it no longer under JSMin. Douglas Crockford was pulled into the conversation, where he expressed his strong opinions on the use of semicolons in JavaScript Semicolon.js is making fun of all of this by adding a semicolon to Vapor.js. (Oh, darn. The person I was replying to deleted their post. Anyway, they said something along the lines of: "I know this is a joke, but I don't get it. Am I missing some subtle commentary?")
- tony_le_montana 15y agoJust wanted to add one more point, same person who authored vapor.js did semicolon.js :-)
- raphman 15y agoThank you for the explanation. I guess a lot of people (like me) were confused by this multi-layer insider joke.
- deleted 15y ago[deleted]
- efnx 15y agoThanks for explaining. I would have spent (too much time) figuring out that joke. It's funny, but not worth (too much time).
- rimantas 15y agoFunny, but I came across the case when whil concatenating files the resulting script was broken, becaus of the missing semicolon at the end of some library. Dropping this script into the list would fix that ;)
- chrisohara 15y agoNo semicolon-min.js ?
- nhebb 15y agoThis one's getting milked for all it's worth: https://github.com/madrobby/semicolon.js/pull/6 https://github.com/madrobby/semicolon.js/pull/6
- rainboiboi 15y agoI looked at the code and..... ;
- alpb 15y agoI see some hilarious animated GIF comments are removed from the issue. This is censorship Twitter, how dare!
- facorreia 15y agoUh wait, does that mean they GPL'd the semicolon?
- john2x 15y agowhat the fuck