On Saturday, July 19, 2003, 4:51:42 PM, Daniel wrote:

> On Sat, Jul 19, 2003 at 03:47:38PM +0900, Gavin Sinclair wrote:
>> I agree it would be cool, but it's pretty clear why Ruby doens't
>> support it:
>> 
>>             2 < 3              == true
>>             1 < true           == error
>>  therefore  1 < 2 < 3          == error
>> 
>> Ruby is a very expression-oriented language, and derives its strength
>> from conceptual purity.  If an expression evaluated to X in some
>> circumstances and Y in others, a small part of Ruby would be lost.

> I realize that this is a dumb question, but what is an expression-oriented 
> language?

Don't worry, I've never seen/heard that assortment of words either.
What I mean is that Ruby gives primacy to expressions (as opposed to
statements).  For instance (not tested):

  extractor =
    case opt
      when "-r" then ReceiptExtractor
      when "-t" then TransactionExtractor
    end.new(filename)

Every chunk of code has a "return value" that can be used to build
larger expressions.

> Can you contrast Ruby with a language that is not expression-oriented?

Try the concepts in the above code in just about any language :)

Many/most languages enforce a difference between "statement" and
"expression".  Pascal is an example.

Gavin