[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why take out remaining arguments when not last
- From: David Kastrup <dak@...>
- Date: Mon, 03 Oct 2011 12:13:12 +0200
Cuero Bugot <cbugot@sierrawireless.com> writes:
> Thanks guys for raising this very flammable subject that is table as
> list and holes, etc...
> Once again few where able to divert the subject :).
> I love Lua table approach and it's well defined # operator (that was
> for the troll part).
>
>
> That said I was very interested in the first question: why the
> returned values of called function are trimmed to one value, unless it
> is the last one. I mean: I would like to understand the rational
> behind it.
They are not only _trimmed_ to one value, but also _extended_ to one
value if necessary.
If I write
a,b,c = f(), g(), h()
do I want to think about whether a will be set to the result of h()
because f and g choose to return nothing? Or c be set to the value of
g() because a returned nil and an error string?
> If the answer is 'limit weird behavior' then it appears that it might
> seem that this trimming is also considered weird by some.
It is "limit", not "eliminate".
--
David Kastrup
- References:
- A very basic thing I don't get, Thijs Koerselman
- Re: A very basic thing I don't get, Peter Cawley
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Michal Kottman
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Philippe Lhoste
- Re: A very basic thing I don't get, steve donovan
- Re: A very basic thing I don't get, Roberto Ierusalimschy
- Re: A very basic thing I don't get, Pascal J. Bourguignon
- Re: A very basic thing I don't get, Dirk Laurie
- Re: A very basic thing I don't get, Axel Kittenberger
- Re: A very basic thing I don't get, Pierpaolo Bernardi
- Why take out remaining arguments when not last (was: A very basic thing I don't get), Cuero Bugot