Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

eschew destructuring assignment #5

Closed
davidchambers opened this issue Mar 19, 2016 · 6 comments
Closed

eschew destructuring assignment #5

davidchambers opened this issue Mar 19, 2016 · 6 comments

Comments

@davidchambers
Copy link
Member

~/github.com/fantasyland/fantasy-eithers (master)
$ node --version
v4.4.0

~/github.com/fantasyland/fantasy-eithers (master)
$ node --print 'require(".")'
/Users/dc/github.com/fantasyland/fantasy-eithers/src/either.js:3
const {tagged, taggedSum} = require('daggy');
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/dc/github.com/fantasyland/fantasy-eithers/fantasy-eithers.js:3:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

~/github.com/fantasyland/fantasy-eithers (master)
$ node --harmony_destructuring --print 'require(".")'
{ [Function: definitions]
  Left: { [Function: wrapped] _length: 1 },
  Right: { [Function: wrapped] _length: 1 },
  of: { [Function: wrapped] _length: 1 },
  EitherT: [Function] }

I'm not sure whether this project is intended to be used or just referenced. If the former, let's avoid language features which require node flags or preprocessing.

@stoeffel
Copy link
Member

This is the case for almost all fantasy-land projects. I think this should be avoided in all of them.

@SimonRichardson
Copy link
Member

@davidchambers I'll think about it, but this was ongoing work and the fact that the readability improves dramatically (for js) I do favour it. Maybe it should have been on another branch rather than a breaking change tbh.

@davidchambers
Copy link
Member Author

The right option depends on whether you intend these packages to be referenced or used.

@joneshf
Copy link
Member

joneshf commented Mar 22, 2016

Sorry, I wasn't aware of this when I made the original suggestion. I guess the latest release on npm isn't this version.

I have to agree though, having to remember flags is a pain. I think until node gets with the times, it's better to suffer a little readability for contributions.

@SimonRichardson
Copy link
Member

If that's the case it's probably better to branch all the repo's off to /unstable and then put the old masters back.

I won't get chance for sometime, so if somebody beats me to it 👍

@davidchambers
Copy link
Member Author

sanctuary-either has been released, and relies only on language features and functions available in ES5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants