* Massimiliano Mirra (list / NOSPAMchromatic-harp.com) wrote:

> On Wed, Jul 31, 2002 at 01:53:37AM +0900, ts wrote:
> >        FileTest.directory?(dir) and raise "Directory #{dir} already
> >        exits"

> My mind has trouble parsing it, though; it goes `well, this and that
> what?'

Ruby isn't trying to recreate English here.  Try to think more in terms
of logical shortcutting so you naturally see that the raise doesn't
get evaluated if the first expression evaluates to false.

This is far more transparent than making another method and passing
blocks to the evaluated value, not to mention being less to type and
faster :)

Subvocalisation is handy occasionally, but it's not particularly a habit
you want to get into; it's just one more layer your reading of the code
has to go through for you to understand it, and it doesn't always map
that well to actual code :)

-- 
Thomas 'Freaky' Hurst  -  freaky / aagh.net  -  http://www.aagh.net/
-
MSDOS is not dead, it just smells that way.
		-- Henry Spencer