From: Julian Fitzell Date: 2001-11-14T12:15:48+09:00 Subject: [ruby-talk:25145] Re: REXML behavior change RFC I definitely approve. Also, you might consider having Element.element[] return the first matching element and Element.elements[] return the full array. This allows people to not use each if they only want to deal with the first element (ie in situations where you only know how to process one child). Julian On 14/11/2001 at 2:30 AM Sean Russell wrote: >Hi, > >This is a general request for comments to all of you who are using REXML. > >The current behavior of Element.elements[] is to return the first >matching element. I propose changing this behavior so that it returns an >array of matching elements. This will allow you to write: > > myel.elements["//blah"].each { |element| ... } > >rather than: > > myel.elements.each("//blah") {|element|... } > >My reasons for wanting the change are: > >1) I was never comfortable with extending "each" to taking an argument in >the first place. I'll deprecate each(...), but will leave it for >backwards >compatibility. > >2) I find that I always start to use the first form, then have to rewrite >it to the second. > >Thanks. > >--- SER > > >-----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- >http://www.newsfeeds.com - The #1 Newsgroup Service in the World! > Check out our new Unlimited Server. No Download or Time Limits! >-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----