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

Parenthesis surprisingly needed by immediate objects #7308

Closed
vicuna opened this issue Jul 28, 2016 · 4 comments · Fixed by #10441
Closed

Parenthesis surprisingly needed by immediate objects #7308

vicuna opened this issue Jul 28, 2016 · 4 comments · Fixed by #10441

Comments

@vicuna
Copy link

vicuna commented Jul 28, 2016

Original bug ID: 7308
Reporter: SpiceGuid
Status: acknowledged (set by @xavierleroy on 2017-02-23T16:07:04Z)
Resolution: open
Priority: low
Severity: feature
Version: 4.03.0
Category: lexing and parsing

Bug description

This is a oneliner :

object method one = 1 end # one;;

Trivially corrected as :

(object method one = 1 end) # one;;

Immediate objects also must also be parenthesised when used as a function actual argument.

Additional information

My intuition is that the end keyword closes a parenthesis.
I don't understand why i should add more nesting.

@github-actions
Copy link

github-actions bot commented May 9, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 9, 2020
@garrigue
Copy link
Contributor

garrigue commented May 9, 2020

Anybody has an opinion on this ?
I don't quite remember why I chose to keep immediate objects as complex expressions.
On the other hand, I personally think that keeping the parentheses makes the code more readable, but other may think differently.

@Drup
Copy link
Contributor

Drup commented May 9, 2020

I remember being surprised multiple times that f object ... end didn't parse.

@github-actions github-actions bot removed the Stale label Jun 10, 2020
@damiendoligez
Copy link
Member

I'd rather let it parse. You'll still be able to add parentheses to make it more readable.

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

Successfully merging a pull request may close this issue.

4 participants