From: Rick DeNatale Date: 2008-06-12T20:50:21+09:00 Subject: [ruby-core:17233] Re: Enumerable::Enumerator#with_memo ------=_Part_9709_29985475.1213271441457 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Jun 11, 2008 at 2:52 AM, David A. Black wrote: > On Wed, 11 Jun 2008, David Flanagan wrote: > > I'm beginning to feel that the method we're discussing here is one >> particular member of a set of methods for defining custom iterations. >> Imagine something like: >> >> a1.each.with_index.and_next_of(a2).and_const(a3).and_returning([]) do >> |elt1, index, elt2, a3, retval| >> end >> >> Or: >> >> [1,2,3].each.alternating_with([4,5,6]).and_returning([]) {|x,ret|...} >> >> Does anyone like the use of "and" instead of "with" to indicate the >> addition of a new value to be passed to the block? >> > > I don't particularly. But then again, I'm not a fan of lots of > chaining that tries to make things sound like English narrative. It > never really does, and I just lose track of it in the Ruby part of my > brain. That's why, as much as I respect the talent and effort behind > it, I can't use RSpec. > I keep hearing this objection to RSpec, and can't help but think that it's based on outdated information. I had lots of issues with RSpec when it first came out, but looked again after talking to David Chelimsky at RubyConf. While it used to use method chaining a lot, it really doesn't any more. And I much prefer x.should be_valid over assert(x.valid?) A small thing perhaps, but small things have a habit of adding up. However de gustibus... -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ------=_Part_9709_29985475.1213271441457 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Jun 11, 2008 at 2:52 AM, David A. Black <dblack@rubypal.com> wrote:
On Wed, 11 Jun 2008, David Flanagan wrote:

I'm beginning to feel that the method we're discussing here is one particular member of a set of methods for defining custom iterations. Imagine something like:

a1.each.with_index.and_next_of(a2).and_const(a3).and_returning([]) do
|elt1, index, elt2, a3, retval|
end

Or:

[1,2,3].each.alternating_with([4,5,6]).and_returning([]) {|x,ret|...}

Does anyone like the use of "and" instead of "with" to indicate the addition of a new value to be passed to the block?

I don't particularly. But then again, I'm not a fan of lots of
chaining that tries to make things sound like English narrative. It
never really does, and I just lose track of it in the Ruby part of my
brain.  That's why, as much as I respect the talent and effort behind
it, I can't use RSpec.

I keep hearing this objection to RSpec, and can't help but think that it's based on outdated information.

I had lots of issues with RSpec when it first came out, but looked again after talking to David Chelimsky at RubyConf.

While it used to use method chaining a lot, it really doesn't any more.

And I much prefer

   x.should be_valid

over

  assert(x.valid?)

A small thing perhaps, but small things have a habit of adding up.

However de gustibus...

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/ ------=_Part_9709_29985475.1213271441457--