From: "Hal E. Fulton" Date: 2002-07-31T02:04:27+09:00 Subject: Re: Syntax proposal ----- Original Message ----- From: "Massimiliano Mirra" To: "ruby-talk ML" Sent: Tuesday, July 30, 2002 11:47 AM Subject: Syntax proposal > I was wondering if a *little* syntactic sugar would help, something > that is readable, makes the condition stand, can be read in one > glimpse, and lies on a single line. > > What do you think of something like this? > > FileTest.directory?(dir) -> raise "Directory #{dir} already exists." How about: FileTest.directory?(dir) ? raise "Directory #{dir} already exists." : nil Not ideal. Better than nothing. Or better, put it in a method. def check_dir_nonexistent(dir) if FileTest.directory?(dir) raise "Directory #{dir} already exists." end end The exception will be propagated back to the caller. Hal