| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Instead of referring to an issue, how about just explaining why we're doing this.
Sorry, something went wrong.
There was a problem hiding this comment.
Adding here as well.
Sorry, something went wrong.
There was a problem hiding this comment.
+1 to @cjihrig's comment. The reference to the issue is unnecessary, I think.
Sorry, something went wrong.
|
In the docs, where it says The special variable _ (underscore) contains the result of the last expression., maybe add another sentence saying that attempting to create a const _ variable will fail. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@cjihrig Updated as per the suggestions. PTAL. |
Sorry, something went wrong.
There was a problem hiding this comment.
Can you add "the" between "in" and "REPL."
Sorry, something went wrong.
|
A couple small comments, but LGTM. Once the CI is fully available, feel free to squash this and run the tests. |
Sorry, something went wrong.
There was a problem hiding this comment.
typo: redefinitions
Sorry, something went wrong.
|
LGTM sans a few minor comments. |
Sorry, something went wrong.
|
@thefourtheye ... can you please rebase and update? |
Sorry, something went wrong.
As `_` is not defined in REPL's context, when it is defined as `const`, it breaks REPL, as it tries to store the result of the last evaluated expression in `_`. This patch makes sure that `_` is pre-defined in REPL's context, so that if users define it again, they will get error. Refer: nodejs#3729 Refer: nodejs#3704
If the `_` is redefined as `const` in REPL, it will break the REPL, as REPL will store the result of the last evaluated expression in `_`. This patch has a test to make sure that the REPL doesn't allow redefining `_` as `const`, also still assiging values to `_` is permitted. Refer: nodejs#3729 Refer: nodejs#3704
When users assign a value to `_` in REPL, it is prone to unexpected results or messing up with REPL's internals. For example, nodejs#3704. This patch issues a warning about the same.
|
Sorry for the delay. I updated and rebased now. PTAL. |
Sorry, something went wrong.
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
As _ is not defined in REPL's context, when it is defined as const,
it breaks REPL, as it tries to store the result of the last evaluated
expression in _. This patch makes sure that _ is pre-defined in
REPL's context, so that if users define it again, they will get error.
This patch has a test to make sure that the REPL doesn't allow
redefining _ as const, also still assiging values to _ is
permitted.
Refer: #3729
Refer: #3704
cc @jasnell @cjihrig @targos @SamuelMarks @Fishrock123