From: Akinori MUSHA Date: 2008-04-20T18:29:40+09:00 Subject: Re: Strange changes in Enumerator --pgp-sign-Multipart_Sun_Apr_20_18:29:39_2008-1 Content-Type: text/plain; charset=US-ASCII At Sat, 19 Apr 2008 00:08:38 +0900, Ola Bini wrote: > While looking through the differences in 1.8.7 and trying to find the > matching changes in the ChangeLog it seems that some things have > happened that breaks backwards compatibility while not being > documented. Specifically, JRuby's testEnumerator suite have some > failures because when enumerator was backported from 1.9, some changes > in that break existing functionality. > > Specific examples: > Enumerator#each_slice and Enumerator#enum_slice is now the same > method, while enum_slice used to have different semantics with regards > to arguments and error reporting. > The same thing seems to have happened with Enumerator#each_cons and > Enumerator#enum_cons. > > Also, something like > Enumerable::Enumerator.new(Object.new).each {} > will now raise a NameError instead of a NoMethodError > > Are these conscious changes, and why can't I find any mention of them > in that case? That was not intentional. The new implementation of enumerator constructor remembers the method by object (Method), while the old one does by name (Symbol). This way it now raises NameError via #method() on initialization where it raised NoMethodError on enumeration before. I'm not sure if and how this affects existing code, but I will at least mention that in NEWS. Thanks for pointing it out! -- Akinori MUSHA / http://akinori.org/ --pgp-sign-Multipart_Sun_Apr_20_18:29:39_2008-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iEYEABECAAYFAkgLDQMACgkQkgvvx5/Z4e4ZvACgvafOM9M8DbP4XK8tgqgKG+9N /lEAoIyYy/DdkUmL36k7aDHfEPujKqTf =rNJw -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sun_Apr_20_18:29:39_2008-1--