We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
def fa {a = 1} p a # works end; fa def fb {2 => b = 2} p b # works end; fb def fc [c = 3] p c end; fc
Error in line 14: instantiating 'fc()' in line 13: read before definition of 'c'
The text was updated successfully, but these errors were encountered:
I'm not sure how to fix it, and I'd probably prefer to give an error if an assignment is used inside a literal (it's confusing)
Sorry, something went wrong.
I don't see why literals should be special cased like this. I'd hate to see this error out.
Nothing wrong with this:
objs = [(a = Obj.new("a")), (b = Obj.new("b"))]
That looks quite ugly. Disclaimer: I'm biased against embedding assignments in other expressions unless extremely necessary.
a, b = objs = [1, 2] pp a # => 1 pp b # => 2 pp objs # => [1, 2]
Isn't this much more clear? (And it works! :))
Successfully merging a pull request may close this issue.
The text was updated successfully, but these errors were encountered: