octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #36221] using ~ as optional output for unique


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #36221] using ~ as optional output for unique causes error in ismember
Date: Wed, 18 Apr 2012 17:21:52 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 Iceweasel/10.0.2

Follow-up Comment #4, bug #36221 (project octave):

With your function


function varargout = newdeal (varargin)
  for n = 1:nargin
    if (isargout (n))
      varargout(n) = varargin(n);
    endif
  endfor
  printf ("nargin = %d, nargout = %d, isargout(%d) = %d\n",
          nargin (), nargout (), nargout (), isargout (nargout ()))
endfunction


I see the following:


octave:2>  [a1, b1, c1] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 1
octave:3>  [a2, b2,  ~] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 0
error: element number 3 undefined in return list
octave:3> [a3, b3, c3] = newdeal (1, 2, 3);
nargin = 3, nargout = 3, isargout(3) = 0
error: element number 3 undefined in return list


I think that in the third call to newdeal, isargout(3) should be true and the
call should succeed.  It seems like isargout is somehow sticky and I don't
think it should be.  Or am I misunderstanding something here?

Also, if isargout(N) is true, I think we should be able to completely omit
setting a value for that output.  The point of isargout is to be able to avoid
calculation, but I think it would annoying if we still had to set values (even
if just []) for unused output values.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?36221>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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