[bug #68101] Missed error with missing tilde in function output

Philip Nienhuis <[email protected]>
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #3, bug #68101 (group octave):


> Current behavior is compatible with Matlab.
Is that bug-for-bug compatibility then, and is it documented Matlab behavior?

I´d say it is at least unexpected behavior; Arun's comment #0 clearly
exemplifies that.
It can even be seen as inconsistent; a missing tilde between consecutive
commas is flagged as an error, but not a missing tilde before a comma.  OTOH a
missing tilde after the last commas is OK.

Consider the following function:

function [a, b, c, d] = testfun
  a = 1;
  b = 2;
  c = 3;
  d = 4;
endfunction

called as follows:

octave:2> [~,b,c,d] = testfun
b = 2
c = 3
d = 4
octave:3> [,b,c,d] = testfun
b = 1
c = 2
d = 3
octave:4> [~,b,~,d] = testfun
b = 2
d = 4
octave:5> [~,b,,d] = testfun
error: syntax error

>>> [~,b,,d] = testfun
         ^
octave:6> [~,b,c,] = testfun
b = 2
c = 3




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68101>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaaMJBAAKCRCqLAuaBUf3
Tnu/AQDqqdNZnA8EXEHe2Bw8/zKF84YY4ZolK2DFHRFbeT/QOgEAyWLBAo6QeVw0
3F+lwlhi0lPLqWThafuW4cFuZ2vDNw8=
=NSYO
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.