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

Back to the future of JS

Back to the future of JS

This is an extended version of my talk I gave @ NodeJs Meetup in Berlin in July 2018

Willian Martins

July 03, 2018
Tweet

More Decks by Willian Martins

Other Decks in Technology

Transcript

  1. @wmsbill this in the global scope Browser - window Web

    worker - self NodeJS - module.exports
  2. @wmsbill How to make this predictable? Reasoning the value of

    this is tricky Function.prototype.bind Arrow function () => {}
  3. @wmsbill Pipeline operator |> It is a syntax sugar for

    function composition It creates a way to streamline a chain of functions
  4. @wmsbill Smart pipeline Two types bare style and topic style

    () or [] are disallowed in bare style When () or [] is needed, topic style is used # token is subject to change
  5. @wmsbill F# pipeline proposal Extends the minimal proposal with an

    await step Await step waits for the resolution of the previous step
  6. @wmsbill What about currying? We can achieve partial application with

    curry Curry ≠ Partial application Curry returns arity n-1
  7. @wmsbill Partial application proposal Creates two new parameters tokens ?

    For single argument . . . for multiple parameters
  8. @wmsbill The . . . token Spread the unbound parameters

    Useful when you want to bound first or last parameter
  9. @wmsbill Should I use all of it in production? These

    proposal are in very early stage The adoption of one, may change the syntax/semantics of other Not production ready (yet)
  10. @wmsbill [].flatMap x [].map [].map guarantees the same array size

    based on input [].flatMap doesn’t guarantees same array length as input array It could be used as filtering
  11. @wmsbill #smooshgate MooTools is an 11 years old ancient lib

    They implemented [].flatten with different behavior The implementation + Elements Enhanced HTML component breaks the compatibility w/ [].flatten