Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

continuation.js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

continuation.js - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

4

package.json
{
"name": "continuation.js",
"description": "CPS transformer with trampoline technique for Node.js",
"version": "0.1.0",
"description": "A module for tail call optimization by Continuation Passing Style (CPS) transformation with trampoline technique for Node.js",
"version": "0.1.1",
"author": "Daishi Kato <daishi@axlight.com>",

@@ -6,0 +6,0 @@ "dependencies": {

continuation.js
===============
CPS transformer with trampoline technique for Node.js
A module for tail call optimization by Continuation Passing Style (CPS)
transformation with trampoline technique for Node.js
JavaScript is a nice programming language, but compared to Scheme,
it lacks the tail call optimization.
Node.js is often used with Callback Passing Style programming
without tail call optimization.
it doesn't handle tail calls properly.
Node.js is often used with callback functions,
which tend to be tail calls (but not necessarily recursions).
This module allows to transform native JavaScript code into
Continuation Passing Style (CPS) code in a best effort manner.
It utilizes so-called trampoline technique to avoid the stack overflow error.
CPS code in a best effort manner.
It utilizes so-called trampoline technique to avoid a stack overflow error.
Transforming all function into CPS is not very easy

@@ -22,20 +23,18 @@ (and sometimes not very efficient),

It is only tested with Node.js, but might be usable
with other JavaScript engines.
Comparison
----------
Here is the table showing related projects.
Here is the table showing modules that support tail call optimization.
| NAME | continuation.js | [Continuation][1] | [Brushtail][2] | [Cinch][3] |
|-------------------------|-----------------|-------------------|----------------|----------------|
| CPS transformation | Mostly | Callback style | No | Callback style |
| Tail Call Optimization | Yes | No | Yes | No |
| Native JavaScript | Yes | No | Yes | Almost |
| `require()` integration | Yes | Yes | No | Yes |
| NAME | continuation.js | [Brushtail][1] | [tailrec.js][2] | [thunk.js][3] | [tail-call][4] |
|-------------------------|-----------------|----------------|-----------------|---------------|----------------|
| Tail Call Optimization | Yes | Yes | Yes | Yes | Yes |
| Mutual TCO | Yes | No | Yes | No | No |
| Native JavaScript | Yes | Yes | No | No | Almost |
| `require()` integration | Yes | No | No | No | No |
[1]: https://github.com/BYVoid/continuation "BYVoid/continuation"
[2]: https://github.com/pufuwozu/brushtail "pufuwozu/brushtail"
[3]: https://github.com/pguillory/cinch "pguillory/cinch"
[1]: https://github.com/pufuwozu/brushtail "pufuwozu/brushtail"
[2]: https://github.com/natefaubion/tailrec.js "natefaubion/tailrec.js"
[3]: https://github.com/jayferd/thunk.js "jayferd/thunk.js"
[4]: https://github.com/Gozala/js-tail-call "Gozala/js-tail-call"

@@ -130,3 +129,3 @@ How to use

* CPS enabled functions have the CpsEnabled=true property.
* Traversing AST to transform into CPS, only when possible!
* Traversing AST to transform into CPS in a best effort manner.
* Keeping original code so that non-CPS is always possible.

@@ -168,3 +167,4 @@

* Transform all tail recursive calls into CPS.
* Work with try...catch and throw.
* Transform non-tail calls into CPS.
* Transform non-tail recursive calls into CPS.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc