[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Odd behaviour with multiple return values and varargs
- From: David Kastrup <dak@...>
- Date: Thu, 13 Sep 2007 13:29:18 +0200
"Tom Miles" <Tom@creative-assembly.co.uk> writes:
>> If I write
>> a,i = f(a),i+1
>> then I want i to get the value i+1 regardless whether f(a)
>> feels like returning two values or not. And the same
>> reliable 1:1 relationship should hold when I use
>> comma-separated argument lists.
> Why would you write something like that knowing that f(a) could possibly
> return multiple values?
Why would I know that? Why should I need to know?
> If you want predictable behaviour then do a = f(a) i = i + 1
If you feel that the above should be allowed to behave unpredictable,
why should you ask me to change my code?
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. And not being
allowed to use any function calls in argument lists without getting
this sort of unpredictability is also not really sane.