From: "David A. Black" Date: 2004-07-07T01:31:03+09:00 Subject: Re: Array::index and rindex operator Hi -- On Wed, 7 Jul 2004, Hal Fulton wrote: > Robert Klemme wrote: > >> I can't remember whether there are any methods that protest > >>if you give an argument and a block.... I have a memory that there > >>are one or two, but I'm not sure what they are. > > > > Well, what implication would that have? Do you mean to say it's not > > common in Ruby to have methods that either accept a block or an argument? > > I think it's common to accept a block or an arg, but it raises the > question of what to do when *both* are given: > > 1. raise an exception > 2. do something meaningful > > And I'm not sure whether most core methods do (1) or (2). I still have this nagging memory of a method that raises an exception when given both, but I can't pin it down. The ones I can think of that don't just ignore the block (which of course any method will do if it doesn't yield) seem to call the block either with the argument (#inject) or with the result of a calculation (File.open). David -- David A. Black dblack@wobblini.net