From: Gavin Sinclair Date: 2002-08-21T10:58:51+09:00 Subject: Re: What makes a 'good' Ruby extension? >> >> http://www.rubygarden.org/ruby?RubyStyleGuide >> > > Maybe I'm old and set in my ways, but I just read that page and while > good, I'm having a little trouble with some aspects of it. > > In the "use iterators" section, it says ... > > Even Better > > Use iterators and higher order functions. These were invented in > LISP, which was around before Algol introduced while and for loops. > Therefore these are very old ways, and have worked fine for the last 50 > years! > > PROMPTS = ["First Name", "Last Name", "Phone"] > first_name,last_name,phone = PROMPTS.map { |prompt | prompt_and_read( > prompt ) } > > > I'm sorry, I'm perfectly capable of grokkin that, but there is no way > (to me) that that example reads better than the initial: > > first_name = prompt_and_read "First name" > last_name = prompt_and_read "Last name" > phone = prompt_and_read "Phone" > > > > The iterator example reads like perl to me, which in and of itself isn't > bad, but it just seems like using a ruby construct for the sake of using > a ruby construct. > > Thoughts? > I quite agree. The original expresses the intention much more clearly. I love parallel assignment and map, but this is not a good use of them. Gavin