Fri, 27 Sep 2002 23:02:25 +0900, William Djaja Tjokroaminata <billtj / z.glue.umd.edu> pisze:

> This is actually rather confusing to me, since in Ruby the '()' is
> optional in a method call.  In all other languages that I have used,
> the '()' is almost always mandatory (I never used Eiffel).

http://merd.net/pixel/language-study/syntax-across-languages.html#FnctnFnctCall

Function call with no parameter:

f     Ada, Eiffel, Haskell, Mercury, Perl, Pliant, Ruby, Tcl, Pascal
f()   Awk, C, C#, C++, Java, Lua, Python
f()   merd, OCaml, SML (there really is a parameter which is the empty tuple)

It might not matter much for standalone functions, but if method call
looks like this:
   x.f(y,z)
then it's nice for parameterless methods and field access to use the
same syntax so code doesn't need to know if it's a field or method:
   x.f
and Ruby indeed does it by wrapping field accessors in methods with
a syntax which looks like field access.

So this is a reason against these empty parens. But here is a
problem with this approach: in languages with first-class functions
the function call can't be simply an expression consisting of the
expression denoting the function and expressions denoting arguments,
because the function name itself already denotes the call with no
arguments.

So taking the function without calling it requires writing something
extra to wrap it in an object, and calling a function passed in a
variable looks differently than calling an explicitly named function.

The last paragraph doesn't apply to Haskell despite the lack of (),
but it's quite a different story.

-- 
  __("<      Marcin Kowalczyk
  \__/     qrczak / knm.org.pl
   ^^    http://qrnik.knm.org.pl/~qrczak/