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

Parsing of .field and .property syntax allows space #46875

Closed
thchr opened this issue Sep 23, 2022 · 2 comments
Closed

Parsing of .field and .property syntax allows space #46875

thchr opened this issue Sep 23, 2022 · 2 comments

Comments

@thchr
Copy link
Contributor

thchr commented Sep 23, 2022

I was surprised to see that this is allowed:

julia> struct A
           a :: Int
       end

julia> A(1).             a
1

I.e., the lowered code just disregards the spaces:

julia> @code_lowered A(1).            a
CodeInfo(
1nothing%2 = Base.getfield(x, f)
└──      return %2
)

A similar thing happens for getproperty.

I imagine that it is not a good idea to fix/change this in Julia v1.x, since there could well be plenty of typos out there that implicitly depend on this - but I was suggested to file an issue for it anyway; at least there's a record of the thought this way.

@mbauman
Copy link
Member

mbauman commented Sep 23, 2022

It looks like we talked about deprecating this in #11891, but perhaps its error message wasn't good enough to make the final cut? Also related is #17305, requesting allowing whitespace on the other side of the ..

@thchr
Copy link
Contributor Author

thchr commented Sep 23, 2022

Ah, okay: those are clearly overlapping. One of the linked threads also had this comment #29781 (comment), which is a reasonable argument for allowing this.

Since this has already been discussed at some length, there is probably little need for another issue: I'll close this.

@thchr thchr closed this as completed Sep 23, 2022
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

2 participants