recentpopularlog in

unbracketed : javascript   91

« earlier  
By example: Continuation-passing style in JavaScript
What is continuation-passing style?
If a language supports continuations, the programmer can add control constructs like exceptions, backtracking, threads and generators.

Sadly, many explanations of continuations (mine included) feel vague and unsatisfying. Such power deserves a solid pedagogical foundation.

Continuation-passing style is that foundation.

Continuation-passing style gives continuations meaning in terms of code.

Even better, a programmer can discover continuation-passing style by themselves if subjected to one constraint:

No procedure is allowed to return to its caller--ever.

One hint makes programming in this style possible:

Procedures can take a callback to invoke upon their return value.

When a procedure is ready to "return" to its caller, it invokes the "current continuation" callback (provided by its caller) on the return value.

A continuation is a first-class return point.
functional  javascript  CPS  continuation  continuation-passing-style 
august 2015 by unbracketed
Speeding up Javascript Test Time 1000x
Eight months ago when I ran our core API tests at Shyp, it took 100 seconds from starting the test to seeing output on the screen. Today it takes about 100 milliseconds:
javascript  testing  speed 
july 2015 by unbracketed
« earlier      
per page:    204080120160

Copy this bookmark:





to read