Issue #7773 has been reported by gaffneyc (Chris Gaffney).
----------------------------------------
Bug #7773: Calling send("attribute=", value) returns nil instead of
value
https://bugs.ruby-lang.org/issues/7773
Author: gaffneyc (Chris Gaffney)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0-rc1
When calling an attribute writer created using either attr_accessor or
attr_writer via send nil is returned from the send call instead of the
new value.
I've attached a test case that is failing on current head (51794) and
2.0.0-rc1. I've done a git bisect and it looks like commit 37228
(db1e99cd) is the first offending commit.
I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
on 2013-02-03 09:42
on 2013-02-06 14:00
Issue #7773 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Feedback
Why do you consider it a bug?
----------------------------------------
Bug #7773: Calling send("attribute=", value) returns nil instead of
value
https://bugs.ruby-lang.org/issues/7773#change-35896
Author: gaffneyc (Chris Gaffney)
Status: Feedback
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0-rc1
When calling an attribute writer created using either attr_accessor or
attr_writer via send nil is returned from the send call instead of the
new value.
I've attached a test case that is failing on current head (51794) and
2.0.0-rc1. I've done a git bisect and it looks like commit 37228
(db1e99cd) is the first offending commit.
I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
on 2013-02-06 16:14
Issue #7773 has been updated by marcandre (Marc-Andre Lafortune). Category set to core Status changed from Feedback to Open Target version set to 2.0.0 nobu (Nobuyoshi Nakada) wrote: > Why do you consider it a bug? I don't know about Chris, but here is why I consider it a bug: * returning nil is less useful than value * it is less intuitive too (to me) * it is a change of behavior (possibly breaking some existing code) * this change of behavior was never announced, discussed or approved AFAIK * the referred commit has no stated or implied intention to change this * the referred commit has no test to that effect What I wonder is: why do you consider it could possibly be a feature? ---------------------------------------- Bug #7773: Calling send("attribute=", value) returns nil instead of value https://bugs.ruby-lang.org/issues/7773#change-35923 Author: gaffneyc (Chris Gaffney) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 ruby -v: 2.0.0-rc1 When calling an attribute writer created using either attr_accessor or attr_writer via send nil is returned from the send call instead of the new value. I've attached a test case that is failing on current head (51794) and 2.0.0-rc1. I've done a git bisect and it looks like commit 37228 (db1e99cd) is the first offending commit. I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
on 2013-02-06 17:01
Issue #7773 has been updated by gaffneyc (Chris Gaffney).
I consider it a bug because the behavior only happens using `send`. If I
were to call `bar=` directly (see below) it returns the value that was
set.
class Foo
attr_writer :bar
end
Foo.new.bar = "test" # => "test"
Should `send` behave differently than sending the message directly?
----------------------------------------
Bug #7773: Calling send("attribute=", value) returns nil instead of
value
https://bugs.ruby-lang.org/issues/7773#change-35926
Author: gaffneyc (Chris Gaffney)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version: 2.0.0
ruby -v: 2.0.0-rc1
When calling an attribute writer created using either attr_accessor or
attr_writer via send nil is returned from the send call instead of the
new value.
I've attached a test case that is failing on current head (51794) and
2.0.0-rc1. I've done a git bisect and it looks like commit 37228
(db1e99cd) is the first offending commit.
I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
on 2013-02-06 17:17
Issue #7773 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to nobu (Nobuyoshi Nakada) gaffneyc (Chris Gaffney) wrote: > I consider it a bug because the behavior only happens using `send`. Actually, it is not a bug itself. An assignment-like method call always returns its right value rather than the return value from the method. The following code shows the difference: class Foo def foo=(x) "foo" end end x = Foo.new p(x.foo = 42) #=> 42 p(x.send(:foo=, 42)) #=> "foo" However, as MarcAndre said, a method defined by attr_accessor used to return its argument, at least in ruby 1.9.3p194. There seems to be a regression. Nobu, could you investigate it? -- Yusuke Endoh <mame@tsg.ne.jp> ---------------------------------------- Bug #7773: Calling send("attribute=", value) returns nil instead of value https://bugs.ruby-lang.org/issues/7773#change-35927 Author: gaffneyc (Chris Gaffney) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.0.0 ruby -v: 2.0.0-rc1 When calling an attribute writer created using either attr_accessor or attr_writer via send nil is returned from the send call instead of the new value. I've attached a test case that is failing on current head (51794) and 2.0.0-rc1. I've done a git bisect and it looks like commit 37228 (db1e99cd) is the first offending commit. I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
on 2013-02-06 18:40
Issue #7773 has been updated by marcandre (Marc-Andre Lafortune).
I meant to assign it to myself... in any case, it's fixed with r39121.
----------------------------------------
Bug #7773: Calling send("attribute=", value) returns nil instead of
value
https://bugs.ruby-lang.org/issues/7773#change-35937
Author: gaffneyc (Chris Gaffney)
Status: Closed
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0
ruby -v: 2.0.0-rc1
When calling an attribute writer created using either attr_accessor or
attr_writer via send nil is returned from the send call instead of the
new value.
I've attached a test case that is failing on current head (51794) and
2.0.0-rc1. I've done a git bisect and it looks like commit 37228
(db1e99cd) is the first offending commit.
I've been able to reproduce on OS X 10.8 and Ubuntu 12.04.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.