Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
; 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/")
; }
@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Apr 16, 2012

This new style is incredibly useful. Not only does it look fantastic because there are no pesky semicolons at the end of each line, it also solves the eternal tabs vs. spaces arguments. All indentation occurs with a mixture of semicolons and spaces. Many developers already have their IDEs set to show whitespace; this feature is no longer needed because the semicolons serve the same purpose. Alignment is clear because there are actual lines, not just some magical line rendered by your editor. Copy/paste always works! No need to worry about vim doubling up on the indentation, or some stupid system displaying 8 spaces for hard tabs. Even better, this style works perfectly in all inputs, the tab key can do what it's supposed to and move focus to the next input. Blank lines, which are often used to increase readability, stand out even more, making the code easier to follow. If you're thinking "what about multi-line arrays and objects?" then you're clearly just building your apps wrong.

Owner

scottgonzalez commented Apr 16, 2012

This new style is incredibly useful. Not only does it look fantastic because there are no pesky semicolons at the end of each line, it also solves the eternal tabs vs. spaces arguments. All indentation occurs with a mixture of semicolons and spaces. Many developers already have their IDEs set to show whitespace; this feature is no longer needed because the semicolons serve the same purpose. Alignment is clear because there are actual lines, not just some magical line rendered by your editor. Copy/paste always works! No need to worry about vim doubling up on the indentation, or some stupid system displaying 8 spaces for hard tabs. Even better, this style works perfectly in all inputs, the tab key can do what it's supposed to and move focus to the next input. Blank lines, which are often used to increase readability, stand out even more, making the code easier to follow. If you're thinking "what about multi-line arrays and objects?" then you're clearly just building your apps wrong.

@skanev

This comment has been minimized.

Show comment Hide comment
@skanev

skanev Apr 16, 2012

Not sure if serious or joking.

But either way, awesome idea! 👍

skanev commented Apr 16, 2012

Not sure if serious or joking.

But either way, awesome idea! 👍

@arbales

This comment has been minimized.

Show comment Hide comment
@arbales

arbales Apr 16, 2012

no

arbales commented Apr 16, 2012

no

@tdreyno

This comment has been minimized.

Show comment Hide comment
@tdreyno

tdreyno Apr 16, 2012

Is this built into Janus yet?

tdreyno commented Apr 16, 2012

Is this built into Janus yet?

@elijahmanor

This comment has been minimized.

Show comment Hide comment
@elijahmanor

elijahmanor Apr 16, 2012

This way I can visually match up braces by following the semi-colons ;)

This way I can visually match up braces by following the semi-colons ;)

@danheberden

This comment has been minimized.

Show comment Hide comment
@danheberden

danheberden Apr 16, 2012

<3 it

<3 it

@eliperelman

This comment has been minimized.

Show comment Hide comment
@eliperelman

eliperelman Apr 16, 2012

Semicolons!

@bsatrom

This comment has been minimized.

Show comment Hide comment
@bsatrom

bsatrom Apr 16, 2012

Win!

bsatrom commented Apr 16, 2012

Win!

@mikehostetler

This comment has been minimized.

Show comment Hide comment
@mikehostetler

mikehostetler Apr 16, 2012

This is FANTASTIC, I now can see with new semi-colon glasses that this is the way I shall write all my CODEZ in the future.

So many semi-colons will ensure that my JAVA Scripts will always uses the latest Internet technologies.

This is FANTASTIC, I now can see with new semi-colon glasses that this is the way I shall write all my CODEZ in the future.

So many semi-colons will ensure that my JAVA Scripts will always uses the latest Internet technologies.

@pcperini

This comment has been minimized.

Show comment Hide comment
@pcperini

pcperini Apr 16, 2012

does this actually work? because you, sir, may've just spoilt javascript for me for good. good show! :D

does this actually work? because you, sir, may've just spoilt javascript for me for good. good show! :D

@jessbowers

This comment has been minimized.

Show comment Hide comment
@jessbowers

jessbowers Apr 16, 2012

april fools, right?

april fools, right?

@davidbitton

This comment has been minimized.

Show comment Hide comment
@davidbitton

davidbitton Apr 16, 2012

Hazah!

Hazah!

@kswedberg

This comment has been minimized.

Show comment Hide comment
@kswedberg

kswedberg Apr 16, 2012

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.

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.

@popthestack

This comment has been minimized.

Show comment Hide comment
@popthestack

popthestack Apr 16, 2012

I don't know. I kind of feel like it needs more semicolons. Preferably at the end of each line.

I don't know. I kind of feel like it needs more semicolons. Preferably at the end of each line.

@jeffa00

This comment has been minimized.

Show comment Hide comment
@jeffa00

jeffa00 Apr 16, 2012

My God. It's full of semi-colons.

jeffa00 commented Apr 16, 2012

My God. It's full of semi-colons.

@mikehostetler

This comment has been minimized.

Show comment Hide comment
@mikehostetler

mikehostetler Apr 16, 2012

Sweet Sweet Semi-Colons

Sweet Sweet Semi-Colons

@adamdbradley

This comment has been minimized.

Show comment Hide comment
@adamdbradley

adamdbradley Apr 16, 2012

I'm just going to start writing directly like uglify and cut the fat at step 1.

I'm just going to start writing directly like uglify and cut the fat at step 1.

@idbentley

This comment has been minimized.

Show comment Hide comment
@idbentley

idbentley Apr 16, 2012

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!

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!

@midu

This comment has been minimized.

Show comment Hide comment
@midu

midu Apr 16, 2012

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 commented Apr 16, 2012

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)
@eliperelman

This comment has been minimized.

Show comment Hide comment
@eliperelman

eliperelman Apr 16, 2012

@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 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.

@Jakobo

This comment has been minimized.

Show comment Hide comment
@Jakobo

Jakobo Apr 17, 2012

@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 commented Apr 17, 2012

@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.

@scottgonzalez

This comment has been minimized.

Show comment Hide comment
@scottgonzalez

scottgonzalez Apr 17, 2012

@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 ;-)

Owner

scottgonzalez commented Apr 17, 2012

@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 ;-)

@benjick

This comment has been minimized.

Show comment Hide comment
@benjick

benjick Apr 17, 2012

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

benjick commented Apr 17, 2012

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

@Qard

This comment has been minimized.

Show comment Hide comment
@Qard

Qard Apr 17, 2012

Urge to kill, rising.

Qard commented Apr 17, 2012

Urge to kill, rising.

@estelle

This comment has been minimized.

Show comment Hide comment
@estelle

estelle Apr 17, 2012

Awesome!

estelle commented Apr 17, 2012

Awesome!

@anddoutoi

This comment has been minimized.

Show comment Hide comment
@anddoutoi

anddoutoi Apr 17, 2012

Could this be built into vim? Maybe we could extend with something like semitabs instead of softtabs and have :retab insert this instead?

Could this be built into vim? Maybe we could extend with something like semitabs instead of softtabs and have :retab insert this instead?

@wjcrowcroft

This comment has been minimized.

Show comment Hide comment
@wjcrowcroft

wjcrowcroft Apr 17, 2012

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.

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.

@nonken

This comment has been minimized.

Show comment Hide comment
@nonken

nonken Apr 17, 2012

WIN: I love how easy it is to read

; if (foo) {
; ; // do something
; ; if (bar) {
; ; }
; } else {
; ; // do something
; }

It's all becoming curly braces :)

nonken commented Apr 17, 2012

WIN: I love how easy it is to read

; if (foo) {
; ; // do something
; ; if (bar) {
; ; }
; } else {
; ; // do something
; }

It's all becoming curly braces :)

@sovcn

This comment has been minimized.

Show comment Hide comment
@sovcn

sovcn Apr 17, 2012

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.

sovcn commented Apr 17, 2012

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.

@kswedberg

This comment has been minimized.

Show comment Hide comment
@kswedberg

kswedberg Apr 17, 2012

Hey folks, sorry to spoil the party, but this is a joke. In other words, it wasn't intended to be taken seriously.

Hey folks, sorry to spoil the party, but this is a joke. In other words, it wasn't intended to be taken seriously.

@idbentley

This comment has been minimized.

Show comment Hide comment
@idbentley

idbentley Apr 17, 2012

@sovcn - That's an implementation detail up to the browsers to fix. We should be writing idiomatic js, optimized for style, not performance.

@sovcn - That's an implementation detail up to the browsers to fix. We should be writing idiomatic js, optimized for style, not performance.

@wayneashleyberry

This comment has been minimized.

Show comment Hide comment
@wayneashleyberry

wayneashleyberry Apr 17, 2012

★★★★★

★★★★★

@midu

This comment has been minimized.

Show comment Hide comment
@midu

midu Apr 17, 2012

@Jakobo omg, you're so right! This is not only super readable but it brings syntax consistency to large teams!

midu commented Apr 17, 2012

@Jakobo omg, you're so right! This is not only super readable but it brings syntax consistency to large teams!

@danheberden

This comment has been minimized.

Show comment Hide comment
@danheberden

danheberden Apr 17, 2012

@kswedberg nice try trying to mislead us - this is totes for reals

@kswedberg nice try trying to mislead us - this is totes for reals

@kswedberg

This comment has been minimized.

Show comment Hide comment
@kswedberg

kswedberg Apr 17, 2012

@danheberden think of the children!

@danheberden think of the children!

@eliperelman

This comment has been minimized.

Show comment Hide comment
@eliperelman

eliperelman Apr 17, 2012

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!

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!

@danheberden

This comment has been minimized.

Show comment Hide comment
@danheberden

danheberden Apr 17, 2012

Thank god for the soldiers of the web such as yourself - may the spirit of the semicolon cause your cup of success to overflow.

Thank god for the soldiers of the web such as yourself - may the spirit of the semicolon cause your cup of success to overflow.

@anddoutoi

This comment has been minimized.

Show comment Hide comment
@anddoutoi

anddoutoi Apr 17, 2012

"The" semicolon is strong with this one.

"The" semicolon is strong with this one.

@cowboy

This comment has been minimized.

Show comment Hide comment
@cowboy

cowboy Apr 17, 2012

The best part is that it looks like the code I already write!! Because my text editor puts the vertical lines in for me already

see

awesome code example

this is from a new aplication im building called "process-content.php"

cowboy commented Apr 17, 2012

The best part is that it looks like the code I already write!! Because my text editor puts the vertical lines in for me already

see

awesome code example

this is from a new aplication im building called "process-content.php"

@alfeg

This comment has been minimized.

Show comment Hide comment
@alfeg

alfeg Apr 18, 2012

@cowboy sweet line numbers ^_^

alfeg commented Apr 18, 2012

@cowboy sweet line numbers ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment