[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
should Octave be more strict about checking number of arguments?
From: |
John W. Eaton |
Subject: |
should Octave be more strict about checking number of arguments? |
Date: |
Wed, 8 Jul 2020 12:28:23 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
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
- should Octave be more strict about checking number of arguments?,
John W. Eaton <=