Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Extending JavaScript the easy way

Extending JavaScript the easy way

Sergi shows an easy way to extend the syntax of JavaScript without having to create a new language. Using sweet.js macros created by Mozilla's Tim Disney, we can extend our favorite language without making big sacrifices, we can add a few small features to our favorite language or we can create entire DSLs that help with the problem at hand, all in an easy way.

Sergi Mansilla

November 01, 2012

More Decks by Sergi Mansilla

Other Decks in Technology


  1. CoffeeScript LispyScript JWacs FlapJax Elm Coco FBJS JS11 Roy Streamline

    JS TypeScript Objective J JS2 Jack Source: http://altjs.org
  2. ?

  3. ?

  4. Use cases Try proposed syntax before it makes into the

    language Create Micro-DSLs for your scenario Use ideas from other languages Make the new <your-silly-name-here>Script Implement basic types You get the idea
  5. Start using it now > npm install sweet.js > sjs

    -o output.js test_macros.sjs > node output.js Node.js Browser https://github.com/iammerrick/require-sweet