[Top][All Lists]

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

[Octave-patch-tracker] [patch #8783] C++ implementation of textscan

From: Lachlan Andrew
Subject: [Octave-patch-tracker] [patch #8783] C++ implementation of textscan
Date: Thu, 25 Feb 2016 03:03:14 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:44.0) Gecko/20100101 Firefox/44.0

Follow-up Comment #60, patch #8783 (project octave):

In Matlab, ReturnOnError returns a valid value when it fails to match a
literal in the format string, or when it finds a number that doesn't have the
correct syntax.  I don't think it is intended to be a try/catch mechanism to
capture, for example, I/O errors.  If it is 0, then an error is thrown on
invalid input.

In Octave (in both textscan.m and textscan.cc, AFAIK) both of those above
errors are silently skipped, and parsing continues.  That means there isn't
really a condition under which ReturnOnError would do anything.

We could emulate Matlab if you think that is desirable.  However, I think a
better solution would be to have three values for ReturnOnError:
 'continue' (default) Read as much as possible, as Octive does now
 1 Return a partial data structure when a parse error occurs
 0 Throw an error when a parse error occurs.

That gives Matlab-compatible behaviour if an explicit Matlab-compatible value
of ReturnOnError is given, but Octave's current behaviour by default. 
However, Matlab code that is trying to be as liberal as possible by specifying
ReturnOnError is now less liberal than the default.

I'm influenced by the TCP/IP philosophy: "Be liberal in what you accept, and
conservative in what you send".  However, error checking is useful.

ExpChar has been implemented in all of these patches.  Matlab used to have a
"BufSize" option, which has disappeared.  Since ytextscan has its own buffer,
I'm considering implementing that option.  What do you think?


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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