summaryrefslogtreecommitdiffhomepage
path: root/doc/limitations.md
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-07-31 03:26:53 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-07-31 03:26:53 +0900
commit4ce9058f64ea9004de6adc7fff491cbdbc01bd43 (patch)
tree7926a456f3fc3d127cb3f6480d59fd92fff6a68e /doc/limitations.md
parente27565152fd939ed8c17e1a4120daa69fdb3f8e4 (diff)
downloadmruby-4ce9058f64ea9004de6adc7fff491cbdbc01bd43.tar.gz
mruby-4ce9058f64ea9004de6adc7fff491cbdbc01bd43.zip
Describe the difference of the keyword argument behavior.
The implementation of keyword arguments is heavily rely on the prototype made by @take-cheeze in #3629.
Diffstat (limited to 'doc/limitations.md')
-rw-r--r--doc/limitations.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/limitations.md b/doc/limitations.md
index afcb7b56e..e0c999aa6 100644
--- a/doc/limitations.md
+++ b/doc/limitations.md
@@ -205,3 +205,25 @@ trace (most recent call last):
[0] -e:1
-e:1: undefined method 'binding' (NoMethodError)
```
+
+## Keyword arguments
+
+mruby keyword arguments behave slightly different from CRuby 2.5
+to make the behavior simpler and less confusing. Maybe in the
+future, the simpler behavior will be adopted to CRuby as well.
+
+#### Ruby [ruby 2.5.1p57 (2018-03-29 revision 63029)]
+
+```
+$ ruby -e 'def m(*r,**k) p [r,k] end; m("a"'=>1,:b=>2)'
+[[{"a"=>1}], {:b=>2}]
+```
+
+#### mruby []
+
+```
+$ ./bin/mruby -e 'def m(*r,**k) p [r,k] end; m("a"'=>1,:b=>2)'
+trace (most recent call last):
+ [0] -e:1
+-e:1: keyword argument hash with non symbol keys (ArgumentError)
+```