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

src: deprecate V8 date conversion helpers #23179

Closed
wants to merge 1 commit into from

Conversation

addaleax
Copy link
Member

These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current Isolate through
Isolate::GetCurrent() (which should be avoided).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current `Isolate` through
`Isolate::GetCurrent()` (which should be avoided).
@addaleax addaleax added the semver-minor PRs that contain new features and should be released in the next minor version. label Sep 30, 2018
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Sep 30, 2018
@addaleax addaleax added the deprecations Issues and PRs related to deprecations. label Sep 30, 2018
1000 * static_cast<double>(t))
#define NODE_V8_UNIXTIME(v) (static_cast<double>((v)->NumberValue())/1000.0);
NODE_DEPRECATED("Use v8::Date::New() directly",
inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not equivalent.
In this case I could imagine a user define time related struct, with no implicit cast to double, e.g.

struct Timestamp {
    double _val;
    explicit operator double() { return _val; };
};

Copy link
Member Author

Choose a reason for hiding this comment

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

While that’s true, I think it’s highly unlikely that such code which uses this method exists.

inline v8::Local<v8::Value> NODE_UNIXTIME_V8(double time) {
return v8::Date::New(v8::Isolate::GetCurrent(), 1000 * time);
})
#define NODE_UNIXTIME_V8 node::NODE_UNIXTIME_V8
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why this is needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because NODE_UNIXTIME_V8 was previously as a macro, it wasn’t in any particular namespace; the inline function here is in the node namespace, though, and can’t be used without some kind of namespace access.

@addaleax
Copy link
Member Author

addaleax commented Oct 3, 2018

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 3, 2018
@danbev
Copy link
Contributor

danbev commented Oct 4, 2018

Landed in ac54469.

@danbev danbev closed this Oct 4, 2018
danbev pushed a commit that referenced this pull request Oct 4, 2018
These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current `Isolate` through
`Isolate::GetCurrent()` (which should be avoided).

PR-URL: #23179
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Oct 4, 2018
These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current `Isolate` through
`Isolate::GetCurrent()` (which should be avoided).

PR-URL: #23179
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
These helpers provide no benefit over the existing V8 API,
and at least one of them fetches the current `Isolate` through
`Isolate::GetCurrent()` (which should be avoided).

PR-URL: #23179
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. deprecations Issues and PRs related to deprecations. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants