should Octave be more strict about checking number of arguments?

"John W. Eaton" <[email protected]>
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <[email protected]>
Bug report 58695 raised the following issue.

Currently, Octave allows function to be called with more input or output 
arguments than can possibly be used or created.  For example,

   function f (), end

may be called as

   f (1)

or

   x = f ()   ## You do get a warning here
   [1, f, 2]  ## But not here...

I think the original intent in Octave was to allow the call warn or 
attempt to do something reasonable (if possible) when no outputs are 
created.  So I could see a reasonable argument made for allowing this 
kind of behavior but I don't know why I thought this was a good thing to 
do and it seems reasonable to have the interpreter detect these types of 
argument number mismatches automatically.

I think Matlab always throws an error if a function is called with more 
input or output arguments than can possibly be used or generated so this 
would improve compatibility somewhat.

Should we change Octave's behavior to match Matlab?  Always?  Just when 
using --traditional mode?

jwe
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.