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: John W. Eaton
Subject: Re: Matlab-style empty output/input arguments support
Date: Fri, 29 Jan 2010 14:08:16 -0500

On 29-Jan-2010, Jaroslav Hajek wrote:

| yes, I agree. But raising an error about undefined element is a
| problem. Currently, expressions cannot produce undefined values - if
| they do, that is an internal error. A multiple assignment in Octave is
| just an expression producing a cs-list, and it can also appear as an
| argument list:
| 
| [c,d] = deal ([a, ~] = deal (1, 2));
| 
| Allowing undefined values as expression results implies checking every
| argument list for nulls, and I really dislike that. I think it would
| be best if the swallowed values were simply substituted by [], i.e. a
| valid value. It's all really just corner cases anyway, and nothing
| extra would need to be changed, just octave_lvalue internals.

How about making ~ create a special kind of empty matrix value that
can only be discarded?  That way

  [c, ~] = deal ([a, ~] = deal (1, 2))

would work, but

  [c, d] = deal ([a, ~] = deal (1, 2))

would fail with an error.  Would it be hard to implement?  Don't we
already have something similar with [] and zeros(0,0)?

jwe


reply via email to

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