-
-
Save scottgonzalez/6d635e9001b92215266a to your computer and use it in GitHub Desktop.
; var http = require('http') | |
; var fork = require('child_process').fork | |
; function fib(n) { | |
; ; if (n < 2) { | |
; ; ; return 1 | |
; ; } else { | |
; ; ; return fib(n - 2) + fib(n - 1) | |
; ; } | |
; } | |
; if (process.argv[2] == 'fib') { | |
; ; var r = fib(40) | |
; ; process.send({ result: r }) | |
; ; process.exit(0) | |
; } else { | |
; ; var server = http.createServer(function(req, res) { | |
; ; ; var child = fork(__filename, [ 'fib' ]) | |
; ; ; child.on('message', function(m) { | |
; ; ; ; res.writeHead(200) | |
; ; ; ; res.end(m.result + "\n") | |
; ; ; }) | |
; ; }) | |
; ; server.listen(8000) | |
; ; console.log("server online at http://localhost:8000/") | |
; } |
Hazah!
A side benefit of this style is that on lines like #7 above, the code starts with a little wink: ; }
Makes me feel warm and fuzzy.
I don't know. I kind of feel like it needs more semicolons. Preferably at the end of each line.
My God. It's full of semi-colons.
Sweet Sweet Semi-Colons
I'm just going to start writing directly like uglify and cut the fat at step 1.
The best part is how each line has a pre-semicolon. Now I don't have to worry about those extra pixels of whitespace on the right hand side of my screen!
Unfortunately it doesn't make my multi-line JSON very happy:
; var cat = {
; ; say: function () {
; ; ; return 'hai'
; ; }
; }
; cat.say()
✗ node hai.js
~/dev/hai.js:2
; ; say: function () {
^
node.js:195
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token ;
at Module._compile (module.js:414:25)
at Object..js (module.js:459:10)
at Module.load (module.js:335:31)
at Function._load (module.js:294:12)
at Array.<anonymous> (module.js:479:10)
at EventEmitter._tickCallback (node.js:187:26)
@midu Scott said:
If you're thinking "what about multi-line arrays and objects?" then you're clearly just building your apps wrong.
And that is an object literal, not JSON.
@midu I think you're approaching it wrong. Everyone knows it's best to build objects sequentially in semi-spaced notation...
; var cat = {};
; cat.say = function () {
; ; ; return 'hai'
; }
; cat.say()
all better.
@jakobo The indentation is incorrect. You can tell because the semicolons look out of place on the return line. Also, you have a trailing semicolon on the first line ;-)
Not only does it look fantastic because there are no pesky semicolons at the end of each line
This is the most stupid argument I've ever heard. Just use semicolon
Awesome!
Could this be built into vim? Maybe we could extend with something like semitabs instead of softtabs and have :retab insert this instead?
Sorry man, you're a little late to the party on this one. I've had my IDE set up to do this for months already...
Any minifier automagically removes all the semicolons for production anyway. I don't know how... it just knows.
WIN: I love how easy it is to read
; if (foo) {
; ; // do something
; ; if (bar) {
; ; }
; } else {
; ; // do something
; }
It's all becoming curly braces :)
It seems to me that this could potentially make the code slower by making the interpreter think it has to parse additional expressions. Depends on how it was designed I think.
Hey folks, sorry to spoil the party, but this is a joke. In other words, it wasn't intended to be taken seriously.
@sovcn - That's an implementation detail up to the browsers to fix. We should be writing idiomatic js, optimized for style, not performance.
★★★★★
@jakobo omg, you're so right! This is not only super readable but it brings syntax consistency to large teams!
@kswedberg nice try trying to mislead us - this is totes for reals
@danheberden think of the children!
I'm currently in the process of writing a build tool that will help you convert your old code to this new convention. Don't worry, help is on the way!
Thank god for the soldiers of the web such as yourself - may the spirit of the semicolon cause your cup of success to overflow.
"The" semicolon is strong with this one.
@cowboy sweet line numbers ^_^
april fools, right?