diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-25 09:01:14 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-11-25 09:07:49 +0900 |
| commit | 762f682b80460929d9c69b1957bcb2aad108ec93 (patch) | |
| tree | edc7d10dd061949ca605a3fac88148c6b0283256 /include | |
| parent | e6b72b2121b981c504f902723b3c1531be001c02 (diff) | |
| download | mruby-762f682b80460929d9c69b1957bcb2aad108ec93.tar.gz mruby-762f682b80460929d9c69b1957bcb2aad108ec93.zip | |
Allow destructuring in formal arguments.
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.
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
