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

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

[Octave-bug-tracker] [bug #61789] new interpreter error for too many inp


From: Hartmut
Subject: [Octave-bug-tracker] [bug #61789] new interpreter error for too many input arguments has no error-id (for too few arguments it has one)
Date: Mon, 10 Jan 2022 16:53:28 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0

URL:
  <https://savannah.gnu.org/bugs/?61789>

                 Summary: new interpreter error for too many input arguments
has no error-id  (for too few arguments it has one)
                 Project: GNU Octave
            Submitted by: hardy
            Submitted on: Mon 10 Jan 2022 09:53:26 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 7.0.90
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

I realised that the interpreter in Octave 7.0.90 automatically throws an
error, when a user-defined function is called with too little or too many
arguments. This is also properly noted in the NEWS file. And in general I like
this improvement of the interpreter.

But this new behavior seems inconsistent to me. I often have functions like
this (in the image packge), which should work equally well under Octave 7 as
under some older Octave versions.


function result = myfunc(a, b);
  if (nargin != 2)
    print_usage ();
  endif
  disp('I do something');
endfunction


With Octave 6.3.0 (and older Octave versions) I get these error messages:
* myfunc() with too little input arguments gives
** error message:   Invalid call to myfunc. ...
** error-id:        Octave:invalid-fun-call

* myfunc(1,2,3) with too many input arguments gives
** error message:   Invalid call to myfunc. ...
** error-id:        Octave:invalid-func-cal

This seemed consistent to me. And there are many BISTs in place to check that
this works properly.

But with the new Octave 7.0.90 I now get this different behavior:
* myfunc() with too little input arguments gives
** error message:   Invalid call to myfunc. ...
** error-id:        Octave:invalid-fun-call
** This is the same as with older Octave versions.

* myfunc(1,2,3) with too many input arguments gives
** error message:    error: myfunc: function falled with too many inputs
** error-id:         (this is empty)

Especially the last behavior (i.e. the error-id being empty when calling a
function with too many input arguments) troubles me. This seems inconsistent
to me.

Is this behavior intentional? Or would it be OK to also assigne the same
error-id to the last error message (with too many input arguments). This
change would make these error messages more consistent and would make it much
easier for packages to maintain their code with error message BISTs that work
in several versions of Octave.

What do you think?




    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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