• Yukihiro "Matz" Matsumoto's avatar
    Allow destructuring in formal arguments. · 762f682b
    Yukihiro "Matz" Matsumoto authored
    e.g.
    ```
    def m(a,(b,c),d); p [a,b,c,d]; end
    m(1,[2,3],4)  # => [1,2,3,4]
    ```
    
    mruby limitation:
    Destructured arguments (`b` and `c` in above example) cannot be accessed
    from the default expression of optional arguments and keyword arguments,
    since actual assignment is done after the evaluation of those default
    expressions. Thus:
    
    ```
    def f(a,(b,c),d=b)
      p [a,b,c,d]
    end
    f(1,[2,3])
    ```
    
    raises `NoMethodError` for `b` in mruby.
    762f682b
parse.y 169 KB