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

repl: allow leading period in multiline input #3835

Closed
wants to merge 1 commit into from

Conversation

Zirak
Copy link
Contributor

@Zirak Zirak commented Nov 15, 2015

When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.

Before:

> ([0, 1, 2]
... .map(x => x + 1))
Invalid REPL keyword

After:

> ([0, 1, 2]
... .map(x => x + 1))
[ 1, 2, 3 ]

When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.

Before:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    Invalid REPL keyword

After:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    [ 1, 2, 3 ]
@thefourtheye thefourtheye added the repl Issues and PRs related to the REPL subsystem. label Nov 15, 2015
@thefourtheye
Copy link
Contributor

Actually, this is intentional. Let's say user types in something invalid, they can always type .break.

@Zirak
Copy link
Contributor Author

Zirak commented Nov 15, 2015

Oh yes, this preserves the current behaviour, just additionally allowing for chaining. So the following still works:

> ([0, 1, 2]
... .break
> 

@thefourtheye
Copy link
Contributor

Oh, that's right. REPL command check happens before this. LGTM then.

@jasnell
Copy link
Member

jasnell commented Nov 16, 2015

LGTM

@jasnell jasnell added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 16, 2015
@jasnell
Copy link
Member

jasnell commented Nov 16, 2015

marked semver-minor since this represents a new capability in the REPL as opposed to a fix.

@thefourtheye
Copy link
Contributor

@jasnell We can argue that its a bug fix, as ([0, 1, 2]\n .map(x => x + 1)) will throw Invalid REPL command right now. But, as 5.1.0 is around the corner, semver-minor is okay I guess.

@jasnell
Copy link
Member

jasnell commented Nov 16, 2015

It's a... ahem.. minor... point ;-) It'll land in v5.x soon either way. It's just not likely to be something that would land in v4.x.

@jasnell
Copy link
Member

jasnell commented Nov 18, 2015

@nodejs/collaborators ... some additional review on this one would be appreciated. thank you!

@Fishrock123
Copy link
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/846/

Our repl tests are pretty good, Rubber-Stamp LGTM if it works.

@trevnorris
Copy link
Contributor

failing tests look unrelated. gtg.

@Fishrock123
Copy link
Contributor

@Zirak your git info is Author: Zirak <[email protected]> Are you ok with that? I can't tell if that's just a username or not. Usually we use full names, but you are not required to if you'd rather be known as something else. :)

@Zirak
Copy link
Contributor Author

Zirak commented Dec 1, 2015

@Fishrock123 On this part of the internet I go as Zirak.

@Fishrock123
Copy link
Contributor

Ok, sounds good. Merging. :)

Fishrock123 pushed a commit that referenced this pull request Dec 2, 2015
When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.

Before:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    Invalid REPL keyword

After:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    [ 1, 2, 3 ]

PR-URL: #3835
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
@Fishrock123
Copy link
Contributor

Thanks, landed in 451254e!

@Fishrock123 Fishrock123 closed this Dec 2, 2015
rvagg pushed a commit that referenced this pull request Dec 5, 2015
When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.

Before:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    Invalid REPL keyword

After:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    [ 1, 2, 3 ]

PR-URL: #3835
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.

Before:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    Invalid REPL keyword

After:

    > ([0, 1, 2]
    ... .map(x => x + 1))
    [ 1, 2, 3 ]

PR-URL: nodejs#3835
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem. 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.

6 participants