Bug #2365
closed
Matrix: poor handling of coercion errors [patch]
Added by marcandre (Marc-Andre Lafortune) about 15 years ago.
Updated over 13 years ago.
ruby -v:
ruby 1.9.2dev (2009-11-08 trunk 25690) [x86_64-darwin10.0.0]
[ruby-core:26736]
Description
=begin
rubydev -r matrix -e 'p Matrix.I(2) - nil'
/usr/local/rubydev/lib/ruby/1.9.1/matrix.rb:533:in -': undefined method
coerce' for nil:NilClass (NoMethodError)
from -e:1:in `'
Expected:
some_where_in_the/matrix.rb:in -': nil can't be coerced into Matrix (TypeError) from -e:1:in
'
Same situation with Vector.
I'd be grateful if you could confirm the attached patch is ok.
=end
Files
- Status changed from Open to Assigned
- Status changed from Assigned to Rejected
=begin
This behavior is the same as an integer:
% ruby-dev -r matrix -e "p 2 - nil"
-e:1:in -': nil can't be coerced into Fixnum (TypeError) from -e:1:in
'
I think that these behavior is Ruby's standard behavior.
=end
=begin
This behavior is the same as an integer:
% ruby-dev -r matrix -e "p 2 - nil"
-e:1:in -': nil can't be coerced into Fixnum (TypeError) from -e:1:in
'
I think that these behavior is Ruby's standard behavior.
As Marc-André explained, the behaviour is demonstrably different: Integer, correctly, raises a TypeError, whereas Matrix raises a NoMethodError. The latter is misleading because it exposes an irrelevant implementation detail (the use of #coerce) rather than describing the problem from the caller's perspective. The message associated with the exception is similarly wanting.
=end
- Status changed from Rejected to Open
=begin
Reopening the issue.
I feel frustation at such an unsatisfactory answer, coming 4 months after this simple request.
I wonder why Keiju insists on remaining maintainer.
=end
=begin
Hi,
2010/3/30 Marc-Andre Lafortune redmine@ruby-lang.org:
Reopening the issue.
I feel frustation at such an unsatisfactory answer, coming 4 months after this simple request.
Think about something nice :-)
In any way, he finally answered the ticket before spec freezing.
I guess he just misunderstood the report. I believe that he'll
notice and correct his wrong answer soon.
--
Yusuke ENDOH mame@tsg.ne.jp
=end
=begin
Hi, Marc-Andre
Are you willing to become a maintainer for matrix?
If so, I'll suggest Keiju resign, and ask matz's views whether
you are accepted as a new maintainer for matrix.
--
Yusuke ENDOH mame@tsg.ne.jp
=end
=begin
Hi,
In message "Re: [ruby-core:29113] Re: Bug #2365 Matrix: poor handling of coercion errors [patch]"
on Tue, 30 Mar 2010 03:22:56 +0900, Yusuke ENDOH mame@tsg.ne.jp writes:
|Are you willing to become a maintainer for matrix?
|
|If so, I'll suggest Keiju resign, and ask matz's views whether
|you are accepted as a new maintainer for matrix.
I agree. For 1.9.2, I don't think we have no time to update the
external API.
matz.
=end
=begin
Hi, Marc-Andre
In [ruby-dev:40847], [ruby-dev:40849] and [ruby-core:29127],
Keiju and matz agreed with maintainer delegation to Marc-Andre.
So, you are now the maintainer for matrix.rb. Congrats!
http://redmine.ruby-lang.org/wiki/ruby/Maintainers
Keiju said that he was ambitious to rewrite matrix.rb in C,
and that he hoped you would take over it. IMO, there is
room to discuss about it, but I let you know that.
Note: Keiju continues to play the role of maintainer for other
libraries that he has maintained, such as irb, mathn, e2mmap,
etc.
--
Yusuke Endoh mame@tsg.ne.jp
=end
- Status changed from Open to Assigned
- Assignee changed from keiju (Keiju Ishitsuka) to marcandre (Marc-Andre Lafortune)
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r27311.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0