lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Rob Kendrick <lua-l@nun.org.uk> writes:

> David Kastrup wrote:
>
>> If you feel that the above should be allowed to behave unpredictable,
>> why should you ask me to change my code?
>
> Just a minute - you're complaining that your code can't cope with
> unexpected values being returned from the function?  That's either
> your or the function's fault, not the language's.

Huh?  We are not talking about "unexpected values", but "an unexpected
number of values" in a hypothetical non-Lua language that then
consequently thwarts the list/value relationship.

I am saying that this non-Lua language is not a good idea, and Tom
Miles demands that I should write code as if I had to deal with this
non-Lua language, and now you call my code "at fault" for not working
under this hypothetical non-Lua language?

I am sure we can get even more absurd if we really try, but I don't
think it worth doing.

>> Anyway, there is no reasonably elegant way to rewrite something like
>>
>> a, i = f(a+1,i), f(i,a)
>>
>> without using temporary variables or other stuff.
>
> function f(x) return x, 1, 2, 3 end
>
> a, b = (f("a")), (f("b"))
>
> print(a, b)
> a	b

I consider it a good thing that Lua does not force us to uglify every
function call in a list like that if we want to be on the safe side.

-- 
David Kastrup