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
Destructuring assignment #2841
Comments
This may be a separate issue, but it seems closely related. Another test shows that being in an instance method is enough to throw off the destructuring. Here we can see that the C:\projects\mruby-bindings\mrbgems\mruby-nanomsg>..\..\mruby-1.1.0\bin\mirb.exe
mirb - Embeddable Interactive Ruby Shell
> class Test
* attr_accessor :a, :b
*
* def array_lit_test
* @a, @b = [1, 2]
* end
*
* def array_variable_test
* ary = [1, 2]
* @a, @b = ary
* end
* end
=> :array_variable_test
> t = Test.new
=> #<Test:0xbcd970>
> t.array_lit_test
=> [1, 2]
# Why isn't this `[1, 2]` as in the previous test?
> t.array_variable_test
=> 2 The same test works outside of any methods on MRuby
|
Your first bug seems to be fixed on master. I can reproduce the second one. It's caused by the codegen's optimization (workaround: set |
Thanks, @cremno. Next time I'll check master before posting an issue. By the way, does anybody know when another release might get tagged? |
Noticing some strange behavior when mruby is performing destructuring assingment inside of an interpolated string, and the assigned value comes from a local variable. Not sure if this belongs in the "not implemented" list or not. If so, let me know and I'll happy to close this and make a comment there instead.
Showing the issue below, copied from my terminal (comments added after). I'm running on Windows, for what it's worth.
Just for reference, MRI seems to handle this fine. I know MRuby isn't MRI (and I love that about it :), but I just wanted to make sure I wasn't doing something syntactically weird...
The text was updated successfully, but these errors were encountered: