Project

General

Profile

Actions

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.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-11-08 trunk 25690) [x86_64-darwin10.0.0]
Backport:
[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

matrix_coercion.diff (3.76 KB) matrix_coercion.diff marcandre (Marc-Andre Lafortune), 11/14/2009 10:35 AM
Actions #1

Updated by ujihisa (Tatsuhiro Ujihisa) about 15 years ago

  • Status changed from Open to Assigned

=begin

=end

Actions #2

Updated by keiju (Keiju Ishitsuka) over 14 years ago

  • 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

Actions #3

Updated by runpaint (Run Paint Run Run) over 14 years ago

=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

Actions #4

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • 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

Actions #5

Updated by mame (Yusuke Endoh) over 14 years ago

=begin
Hi,

2010/3/30 Marc-Andre Lafortune :

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

=end

Actions #6

Updated by mame (Yusuke Endoh) over 14 years ago

=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

=end

Actions #7

Updated by matz (Yukihiro Matsumoto) over 14 years ago

=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 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

Actions #8

Updated by mame (Yusuke Endoh) over 14 years ago

=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

=end

Actions #9

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • Status changed from Open to Assigned
  • Assignee changed from keiju (Keiju Ishitsuka) to marcandre (Marc-Andre Lafortune)

=begin

=end

Actions #10

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • 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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0