octave-maintainers
[Top][All Lists]
Advanced

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

Re: Matlab-style empty output/input arguments support


From: Dupuis
Subject: Re: Matlab-style empty output/input arguments support
Date: Fri, 29 Jan 2010 04:06:45 -0800 (PST)



Jaroslav Hajek-2 wrote:
> 
> The problem with option 1 (shrinking the list) is that you wouldn't be
> able to do things like
> [d, ~, f] = [a, ~, c] = myfun (...)
> with the obvious meaning (f would be undefined here).
> 
> I like option 2 in the sense that ~ produces [] in this context.
> There's no need to allow ~ anywhere.
> 
> thanks for the suggestion. I'll wait for more opinions and unless
> someone disagrees I'll probably go for this option.
> 
> 
To me, the problem boils down to the lifetime of the function output
argument. In something like
[a, ~, b] = [c, d, ~] = somefunc(),
the steps are
1) the function returns three arguments
2) evaluating right to left, the first assignement results in the first
output argument copied to c, the second to d, and the third is not used
3) now, from what does [a, ~, b] receive a value ?
   - if we consider that we are reusing the function three output arguments,
which should still be on scope, and disregard what was assigned previously,
the operation makes sense : b receive the value of the third output argument
   - if we consider that, after the first assignment, the output arguments
are out of scope and the value taken from the [c, d, ~] construct, then what
should 'b' receive is ill-defined : is it an error, or should it receive an
empty value ?

The real question is thus what should the assignement operator return ? A
pointer to the destination object, of a pointer to the source object ?

Regards

Pascal
-- 
View this message in context: 
http://old.nabble.com/Matlab-style-empty-output-input-arguments-support-tp27337966p27371096.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]