Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecate the use of map/fiter/reduce (see #505) #856

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

Closed
wants to merge 1 commit into from
Closed

Deprecate the use of map/fiter/reduce (see #505) #856

wants to merge 1 commit into from

Conversation

AugustinLF
Copy link

As said in #505 some functions of Record don't behave as expected. They plan to be removed, but for now, it's confusing for anyone not aware of the problem (you can easily lose a couple of hours because of that), so warning the user should be reasonable way to let them know.

You mention "other API methods", but not knowing which ones you're talking about, I'll add them later if needed :)

function deprecateFunction(RecordPrototype, functionName) {
RecordPrototype[functionName] = function(...params) {
console.warn(`Record${functionName} has been deprecated. See https://github.com/facebook/immutable-js/issues/505 for more details`);
return KeyedCollection.prototype[functionName].call(this, ...params);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have used super to access KeyedCollection prototype, but the transpiler refuses it.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@ghost
Copy link

ghost commented Apr 29, 2016

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@ghost ghost added the CLA Signed label Apr 29, 2016
// https://github.com/facebook/immutable-js/issues/505
function deprecateFunction(RecordPrototype, functionName) {
RecordPrototype[functionName] = function(...params) {
console.warn(`Record${functionName} has been deprecated. See https://github.com/facebook/immutable-js/issues/505 for more details`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you're missing a separator between Record and the ${functionName}, otherwise it will be parsed into: Recordfilter 😊

@lacker
Copy link

lacker commented Dec 6, 2016

It looks like this PR has been abandoned since that last comment never got any response. I am going to close it under that theory but if you are still interested in working on this please feel free to reopen!

@lacker lacker closed this Dec 6, 2016
@AugustinLF
Copy link
Author

Hey, sorry for not updating before, since I didn't get any feedback on the PR, I dropped it! I amended my commit, but I think that since you closed the PR, it doesn't show up anymore.

I can rebase my branch on top of master if you want!

@lacker
Copy link

lacker commented Dec 6, 2016

OK let's see what we should do here. I guess one question is how we should handle deprecations. I don't think the approach of doing a console.warn when you use it is quite the right one - that might cause trouble in some environments because you might have console.warn do something very interrupty and not even realize what's happening. I think we would be better off just commenting that methods are deprecated, and then removing them in the next major version bump. I will ping @leebyron about what the right timing is here.

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

Successfully merging this pull request may close these issues.

4 participants