Skip to content

Handling of comma at the end of the line in REPL #28506

Closed

Description

If you enter an expression in REPL that terminates with a comma , then it is parsed immediately after newline , e.g.

julia> x = 1,
(1,)

julia> 1, 2, 3,
(1, 2, 3)

However in Julia script after , Julia tries to read continuation of the expression from a new line, e.g.

julia> function f()
1,
1, 2, 3
end

julia> f()
(1, 1, 2, 3)

This is inconsistent. The problem is apparent when you have a code and you copy paste it into REPL.

E.g. in the example above copy-pasting only the body of f() into REPL produces:

julia> 1,
(1,)

julia> 1, 2, 3
(1, 2, 3)

I guess it is not intended as I would expect consistency between REPL?
I know that 100% consistency is not guaranteed - e.g. when multiple empty lines are present, but this case seems that it should give the same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

parserLanguage parsing and surface syntax

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions