----- Original Message -----
From: "Massimiliano Mirra" <list / NOSPAMchromatic-harp.com.web-hosting.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
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