Op 2006-02-03, Ben Sizer schreef <[EMAIL PROTECTED]>:
>
> [EMAIL PROTECTED] wrote:
>> The main reason (at least for me) is that there's simply too much
>> "magic" in it. Why does the expression left of the '.' get promoted to
>> the first parameter?
>
> One of the reasons I like Lua is because it doesn't do this, instead
> using the : operator to designate method-style calls.
>
> eg.
> a:foo(b, c) -- looks up foo within a, and calls it with (a, b, c) as
> parameters
> a.foo(b, c) -- looks up foo within a, and calls it with (b,c) as
> parameters
>
> This means there doesn't need to be a distinction between methods and
> functions, just a different operator to treat a function as if it was a
> method.

That is nice. I wonder if the following is possible in Lua:

  fun = a:foo
  fun(b, c)

with the same effect as:

  a:foo(b, c)

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to