On Sat, 19 Jul 2003 15:51:42 +0900, Daniel Carrera wrote:
> On Sat, Jul 19, 2003 at 03:47:38PM +0900, Gavin Sinclair wrote:
>> 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?

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

Expression-oriented languages return values from the expressions.
Statement-oriented languages don't. Perl and Ruby are expression-
oriented; C and Pascal are not.

    # Ruby
  def foo
    "Foo"
  end
  puts foo

    # Perl
  sub foo {
    "Foo"
  }
  print &foo;

    /* C */
  char *foo() {
    return "Foo";
  }
  printf("%s\n", foo());

    { Pascal }
  Function foo: Return String;
  Begin
    Return "Foo";
  End;
  WriteLn(Foo());

The C and the Pascal require explicit return statements to work. The
Perl and Ruby do not.

-austin
--
austin ziegler    * austin / halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.07.19
                                         * 12:06:45