[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: implicit parameters
- From: "Nick Trout" <nick@...>
- Date: Fri, 9 Feb 2001 10:44:39 -0000
>>>
- Removed the implicit self parameter in function definitions of the
special form function foo:bar(...)...end. You have to name _all_
arguments.
function foo:bar(a,b,c) --> function foo:bar(self,a,b,c)
<<<
>I have to agree with Edgar here. What is the point of an implicit self in
the parameter list
when in the function we have to spell out member variable accesses anyway?
It's like the
monster child of C++ and Python.
>>>
- Vararg syntax has changed. Instead of ... that generates an
automatic arg parameter you now have to write name[]. So a
vararg function looks like this:
function foo:bar(...) --> function foo:bar(self, arg[])
<<<
I agree with both of the above! It stops people confusing a.b() and a:b() as
well I think which takes a bit of getting your head round. It makes the code
much clearer to read, ie. these "magical" variables doesnt appear from
nowhere :-) Its difficult to explain to novices why it appears in some
places and not others! As mentioned, Python uses this syntax. I keep going
back to Python as a reference language but thats because its really nice to
use and easy to maintain because of its clarity. You can just look at a
piece of code and not have to work out the context (ie. are we in a class,
do we have variable argument syntax...).
Have you though about adding augmented operators eg. +=, -= etc in Sol?
N