Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

old flags for previous node versions should result in no-op, not error, for current version (?) #9400

Closed
ORESoftware opened this issue Nov 1, 2016 · 13 comments
Labels
feature request Issues that request new features to be added to Node.js. v8 engine Issues and PRs related to the V8 dependency.

Comments

@ORESoftware
Copy link
Contributor

ORESoftware commented Nov 1, 2016

This regards Node versions 6.7 and 4.5, but could possibly involve more versions.

In v4.5, we could allow for deconstructive assignment with the --harmony_destructuring flag.

However, in v6.7 if we use that flag, it says:

node: bad option: --harmony_destructuring

and a quick check => node --v8-options

shows us that the new relevant flag in version 6.x is called:

--harmony_destructuring_assignment

So what that means is that I need some conditionals in my library such that if a user is using a certain version of Node I use the first flag, and if the user is using another version of Node, I use the second flag.

Is there a way to mitigate this problem?

I suppose that one solution could be that using --harmony_destructuring with Node version 6 should result in a no-op (just a warning or something) since it was a flag that existed in old Node versions.

@addaleax addaleax added v8 engine Issues and PRs related to the V8 dependency. feature request Issues that request new features to be added to Node.js. labels Nov 1, 2016
@mscdex
Copy link
Contributor

mscdex commented Nov 1, 2016

See #8395 and #8445. This is the kind of thing I was afraid of -- more requests for no-op flags. I am still -1 on doing this.

@ORESoftware
Copy link
Contributor Author

ORESoftware commented Nov 1, 2016

I can see the downsides, just want to say this is something that happened to me is not externally motivated by any existing issues :)

@ORESoftware
Copy link
Contributor Author

ORESoftware commented Nov 1, 2016

To illustrate exactly what I am talking about, the main problem case for me is, we have bin files in Node projects, that usually start with something like:

#!/usr/bin/env node --harmony

now if I want to support destructuring in older node versions, I would do:

#!/usr/bin/env node --harmony --harmony_destructuring

but this throws on the latest version, so I would have do some weird bash conditional logic to switch commands based of the node version. If someone knows how to that conditional logic, then I would be willing to forget about this :)

and to take this one step further, imagine if the latest version is Node 17, and someone throws in the --harmony flag, is it a no-op or do we throw an error? Seems like going forward best to just log a warning or something and make it a no-op.

@ORESoftware ORESoftware changed the title old flags for previous node versions should result in no-op, not error old flags for previous node versions should result in no-op, not error (?) Nov 1, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Nov 1, 2016

Still -1 from me as well.

@ORESoftware
Copy link
Contributor Author

ORESoftware commented Nov 1, 2016

@cjihrig the underlying problem for me was described immediately above, is there a solution? Node is making it hard for me to support multiple Node versions for a library that is supposed to support multiple Node versions :)

@ORESoftware ORESoftware changed the title old flags for previous node versions should result in no-op, not error (?) old flags for previous node versions should result in no-op, not error, for current version (?) Nov 1, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Nov 1, 2016

You shouldn't be using the harmony flags for production grade code. They enable features that typically aren't production ready. If you just have to use the latest and greatest language features for some reason, you can transpile the code.

@ORESoftware
Copy link
Contributor Author

Good point

@Fishrock123
Copy link
Contributor

Imo this is the risk you take hard-coding flags anywhere. Major versions may change them in dependencies, that's just how it is really.

@ORESoftware
Copy link
Contributor Author

ORESoftware commented Nov 1, 2016

Well, backwards compatibility is a nice-to-have :) Just because JS changes fast doesn't mean Node.js has to not be BC. Ok maybe it does :)

@Fishrock123
Copy link
Contributor

The existing policy has already been to not support backwards compat for dependency flags across major versions. I don't think that has or will change.

@hashseed
Copy link
Member

Backwards compatibility for experimental feature flags... If you really want to go that way, why don't you just write a wrapper script that omits flags that are not listed with --help?

@targos
Copy link
Member

targos commented Jan 8, 2017

-1 from me as well. I don't want to have to maintain floating patches for experimental flags support.

Can we close this? It seems no collaborator has expressed a favorable opinion.

@bnoordhuis
Copy link
Member

Yes, let's close. I'm -1 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

8 participants