[#70843] Re: [ruby-cvs:58952] hsbt:r51801 (trunk): * lib/rubygems: Update to RubyGems HEAD(fe61e4c112). — Eric Wong <normalperson@...>
hsbt@ruby-lang.org wrote:
3 messages
2015/09/17
[ruby-core:70649] Re: the undefined behavior of an iterator if it is modified inside of the block to which it yields
From:
Daniel Doubrovkine <dblock@...>
Date:
2015-09-01 11:09:25 UTC
List:
ruby-core #70649
I completely agree. Behavior of iterators is always defined on some specific type, not in general. I am not proposing to define how &:each behaves for everyone, I propose Ruby defines the iterator behavior in this case on all its core classes, the implementors of other iterators can define their own if they like, just like they would do today. The real world works the same way. The escalator behavior is defined, but not one of all hypothetical stairways. On Mon, Aug 31, 2015 at 9:26 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote: > On 2015/09/01 1:08, Daniel Doubrovkine wrote: > > I'd like to suggest we change the behavior from "undefined" to "defined" > in some future version of Ruby. It seems that in the real world such > behavior is very well defined, ie. if you're climbing an escalator and a > step appears in front of you before you jump off, you're going to be > stepping on it and not having "undefined" behavior :) > > Your subject is too big. > Since it's implementation issue, so we could define the behaviors of Array > methods, but not other enumerable objects in the world. > -- dB. | Moscow - Geneva - Seattle - New York code.dblock.org - @dblockdotorg <http://twitter.com/#!/dblockdotorg> - artsy.net - github/dblock <https://github.com/dblock>