From: Massimiliano Mirra Date: 2002-09-08T00:43:58+09:00 Subject: Re: Ruby aesthetics On Sat, Sep 07, 2002 at 01:39:55AM +0900, Yukihiro Matsumoto wrote: > In my opiniton, the bit amount in your brain saved by eliminating > equivalence is next to nothing. Human brain can handle these > equivalences very easily, unless they cause exponential combination > explosion. And I don't think anybody had troubles reading that last sentence (STATEMENT unless CONDITION). Sure, it could also be written like this: ``If these equivalences do not cause exponential combination explosion, human brain can handle them very easily.'' But would it express the same thing? No. In Matz's sentence, the statement comes first; it is read unfiltered, and it gets the most importance; the condition appears to be exceptional and probably is not relevant in most cases. In the second version, the reader has to wear conditional glasses before getting to the statement. The how is part of the what. How does this translate in code? if not File.exists?('/tmp') Dir.mkdir('/tmp') end Here I'm basically saying that I want to create /tmp. Does a programmer that is reading my source need to grok `if not File.exists?('/tmp')' first? Or am I addressing the computer, that is not smart enough to figure out I want the directory no matter what? I really appreciate that in Ruby I can write: Dir.mkdir('/tmp') unless File.exists?('/tmp') This lets me communicate my thought easily to people that think like people rather than to people that got used to think like parsers. (And although you might find it hard to believe, that is no invite for anyone to flame. That's a good skill and there's many a case I'd like to have it.) Massimiliano