[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    Re: Strange Array#transpose behavior for custom to_ary method
From:       Yukihiro Matsumoto <matz () ruby-lang ! org>
Date:       2007-06-16 13:09:28
Message-ID: E1HzY1j-000719-Do () x31
[Download RAW message or body]

Hi,

In message "Re: Strange Array#transpose behavior for custom to_ary method"
    on Sat, 16 Jun 2007 21:05:01 +0900, Daniel Berger <djberg96@gmail.com> writes:

|> No, to_ary is to convert non-array object into array when it's used as
|> an operand.  In this case, Foo is not non-array nor operand.

|Can we say then, as a general rule, that defining a custom to_ary method 
|on an array object results in undefined behavior for certain methods?

I don't call it "undefined", but it might be differ from _your_
expectation.  to_ary is designed to be a part of mimicking array-like
duck.  Defining to_ary only may cause inconsistent behavior.

							matz.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic