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

String prompt pasting #42127

Open
diegozea opened this issue Sep 5, 2021 · 1 comment
Open

String prompt pasting #42127

diegozea opened this issue Sep 5, 2021 · 1 comment
Labels
REPL Julia's REPL (Read Eval Print Loop)

Comments

@diegozea
Copy link
Contributor

diegozea commented Sep 5, 2021

Hi!

I have just notice that Julia errors when prompt pasting a String. It can not realize that the second string is the output of the first one, and tries to uses the first one as the docstring of the second:

julia> "String"
"String"

Screenshot from 2021-09-05 14-37-29

I have found this on:

Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

Best,

P.S. It works fine in Pluto:

julia> value = 2 + 2
4

julia> "Result: $value"
"Result: 4"

Screenshot from 2021-09-05 14-43-27

@sostock sostock added the REPL Julia's REPL (Read Eval Print Loop) label Sep 5, 2021
@KristofferC
Copy link
Member

KristofferC commented Sep 20, 2021

Was also observed in #17599 (comment).

The way the prompt paste work is that as much as possible that is valid to parse gets parsed, the rest gets discarded. So if you paste

julia> 1+1
       errorerror

it will just execute 1+1. Since

"String"
"String"

is valid syntax, that is what will be used. I guess this could be solved explicitly looking for this scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

No branches or pull requests

3 participants