nybblr / closures

You won’t believe this one weird way to rewrite closures.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This JS repo will restore your faith in closures.

Rewrite closures and scoping rules from scratch. Entirely in JavaScript. Using prototypal inheritance, some clever hat-tips from graphics programming, amnesic function bodies, and this one weird global variable.

Slides are up on Speaker Deck.

Convert code to closure-less equivalent

To convert some regular JavaScript to the closure-less version demoed, go to https://nybblr.github.io/closures/ and drop in some code.

Note that it is extremely limited and won't handle any edge cases (e.g. multiple var declarations per line, function declarations, etc.)

About

You won’t believe this one weird way to rewrite closures.


Languages

Language:JavaScript 99.5%Language:HTML 0.5%Language:Makefile 0.1%