summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-09-04 01:25:00 +0900
committerGitHub <[email protected]>2019-09-04 01:25:00 +0900
commit2df419e324273aa7c7729bf2ad228e13b0944dfd (patch)
tree0cbe37016ae0e97eb42485ac58b490af77fe22e0
parent148fffa21ad5cbf42526ce393d24cb214167a82e (diff)
parent74e7c4aa0b89fd58ba6d2db484a8eaec291bdada (diff)
downloadmruby-2df419e324273aa7c7729bf2ad228e13b0944dfd.tar.gz
mruby-2df419e324273aa7c7729bf2ad228e13b0944dfd.zip
Merge pull request #4686 from shuujii/add-to-doc-limitations.md-about-nil-redefinition
Add to `doc/limitations.md` about `nil?` redefinition; ref 4996709 [ci skip]
-rw-r--r--doc/limitations.md20
1 files changed, 17 insertions, 3 deletions
diff --git a/doc/limitations.md b/doc/limitations.md
index 20e2dc52f..e6f40a942 100644
--- a/doc/limitations.md
+++ b/doc/limitations.md
@@ -126,7 +126,7 @@ true
true
```
-## defined?
+## `defined?`
The `defined?` keyword is considered too complex to be fully
implemented. It is recommended to use `const_defined?` and
@@ -186,7 +186,7 @@ The re-defined `+` operator does not accept any arguments.
` 'ab' `
Behavior of the operator wasn't changed.
-## Kernel#binding is not supported
+## `Kernel#binding` is not supported
`Kernel#binding` method is not supported.
@@ -238,7 +238,7 @@ 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:
-
+
```ruby
def f(a,(b,c),d=b)
p [a,b,c,d]
@@ -247,3 +247,17 @@ f(1,[2,3])
```
CRuby gives `[1,2,3,nil]`. mruby raises `NoMethodError` for `b`.
+
+## `nil?` redefinition in conditional expressions
+
+Redefinition of `nil?` is ignored in conditional expressions.
+
+```ruby
+a = "a"
+def a.nil?
+ true
+end
+puts(a.nil? ? "truthy" : "falsy")
+```
+
+Ruby outputs `falsy`. mruby outputs `truthy`.