[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:63387] [ruby-trunk - Bug #9593] Keyword arguments default argument assignment behaviour not consistent with optional argument
From:
nagachika00@...
Date:
2014-06-28 05:55:07 UTC
List:
ruby-core #63387
Issue #9593 has been updated by Tomoyuki Chikanaga.
Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONTNEED
No objection. I changed Backport field to `DONTNEED`.
----------------------------------------
Bug #9593: Keyword arguments default argument assignment behaviour not consistent with optional argument
https://bugs.ruby-lang.org/issues/9593#change-47430
* Author: Jack Chen
* Status: Closed
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: syntax
* Target version: current: 2.2.0
* ruby -v: 2.1.1
* Backport: 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONTNEED
----------------------------------------
Given the following code:
def var
100
end
def foo(var: var + 1)
puts "var: #{var.inspect}"
end
def bar(var = var + 1)
puts "var: #{var.inspect}"
end
foo(var: 1)
foo rescue p $!
bar(1)
bar
Ruby 2.0.0:
var: 1
var: 101
var: 1
var: 101
Ruby 2.1.1:
var: 1
#<NoMethodError: undefined method `+' for nil:NilClass>
var: 1
var: 101
What appears to be happening is that since 2.1.1, the keyword argument defines `var` as a variable before evaluating the default argument. Personally, I prefer 2.0.0 behaviour, but the way 2.1.1 handles default arguments in non keyword arguments is inconsistent.
--
https://bugs.ruby-lang.org/