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 interpolation with terminal dot breaking 1.2 -> 1.3 #33044

Closed
matbesancon opened this issue Aug 23, 2019 · 4 comments
Closed

String interpolation with terminal dot breaking 1.2 -> 1.3 #33044

matbesancon opened this issue Aug 23, 2019 · 4 comments
Assignees

Comments

@matbesancon
Copy link
Contributor

matbesancon commented Aug 23, 2019

This is more a difference than a bug, but definitely breaking:

1.2:

julia> var = 3
3
julia> println("Hello from var $var.")
Hello from var 3.

1.3-rc1:

julia> var = 3
3

julia> println("Hello from var $var.")
ERROR: syntax: unexpected ")"
Stacktrace:
 [1] top-level scope at REPL[1]:0

From HISTORY.md:

Non-parenthesized interpolated variables in strings, e.g. "$x", must be followed by a character that will never be an allowed identifier character (currently operators, space/control characters, or common punctuation characters) (#25231).

So this was sort of warned but not erroring before 1.3

Edit

Going even deeper, the error does not happen with 1-char variable identifiers:

julia> x = 1
1

julia> "$x."
"1."

julia> println("$x.")
1.
@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Aug 23, 2019

This is a bug and it's specific to the name var. Making var"..." parse specially is having a lot more fallout than naively anticipated. cc @c42f

@KristofferC
Copy link
Sponsor Member

KristofferC commented Aug 23, 2019

Fixed by #32948.

Let's not count multiple identical bug reports against a nice feature. :)

@matbesancon
Copy link
Contributor Author

Ok my initial assumptions were extremely overfitted, thanks all

@StefanKarpinski
Copy link
Sponsor Member

Great. I'm glad that it's already fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants