Skip to content

Commit

Permalink
doc: warn about reassigning _ in REPL
Browse files Browse the repository at this point in the history
When users assign a value to `_` in REPL, it is prone to unexpected
results or messing up with REPL's internals. For example,
#3704. This patch issues a warning
about the same.
  • Loading branch information
thefourtheye committed Feb 25, 2016
1 parent c2a3731 commit 48d79a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/repl.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ The special variable `_` (underscore) contains the result of the last expression
4
```

*NOTE*: Explicitly assigning a value to `_` in the REPL can produce unexpected
results. Also, attempting to create `_` as a `const` variable in the REPL will
fail.

The REPL provides access to any variables in the global scope. You can expose
a variable to the REPL explicitly by assigning it to the `context` object
associated with each `REPLServer`. For example:
Expand Down

0 comments on commit 48d79a4

Please sign in to comment.