Codebase list mruby / 74e7c4a
Add to `doc/limitations.md` about `nil?` redefinition; ref 4996709 [ci skip] KOBAYASHI Shuji 4 years ago
1 changed file(s) with 17 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
125125 true
126126 ```
127127
128 ## defined?
128 ## `defined?`
129129
130130 The `defined?` keyword is considered too complex to be fully
131131 implemented. It is recommended to use `const_defined?` and
185185 ` 'ab' `
186186 Behavior of the operator wasn't changed.
187187
188 ## Kernel#binding is not supported
188 ## `Kernel#binding` is not supported
189189
190190 `Kernel#binding` method is not supported.
191191
237237 from the default expression of optional arguments and keyword arguments,
238238 since actual assignment is done after the evaluation of those default
239239 expressions. Thus:
240
240
241241 ```ruby
242242 def f(a,(b,c),d=b)
243243 p [a,b,c,d]
246246 ```
247247
248248 CRuby gives `[1,2,3,nil]`. mruby raises `NoMethodError` for `b`.
249
250 ## `nil?` redefinition in conditional expressions
251
252 Redefinition of `nil?` is ignored in conditional expressions.
253
254 ```ruby
255 a = "a"
256 def a.nil?
257 true
258 end
259 puts(a.nil? ? "truthy" : "falsy")
260 ```
261
262 Ruby outputs `falsy`. mruby outputs `truthy`.