help-octave
[Top][All Lists]
Advanced

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

Re: Too many arguments?


From: John W. Eaton
Subject: Re: Too many arguments?
Date: Thu, 6 Aug 2009 17:08:41 -0400

On  6-Aug-2009, Jaroslav Hajek wrote:

| 1. The presence of an extra argument can be used as a flag (think what
| qr does), while the actual value is not needed anywhere (and hence
| needs not be named). It's not very pretty usage, but possible.

I think in most cases where something like this is done, the argument
is named, but you are right that it is possible (at least in Octave)
to just check to see if an extra argument is present using nargin,
even if the argument doesn't appear in the parameter list.  So, OK.

| 2. Excess output arguments are also ignored silently (is this the same
| in Matlab?).

I think so.

| 3. Most, if not all, functions already include checks for nargin, so
| giving excess arguments generates an error anyway; however, you'd take
| away the possibility to customize the message.

OK.

| 4. I think you're sometimes being too pessimistic about how pedantic
| may "some people" be about Matlab compatibility. If this difference
| actually breaks someone's code, that code must be really crazy. And as
| you say, it would be trivial to change, so let's just wait until, if
| ever, the need arises.

It's fine with me to leave the behavior as it is.  I was just thinking
that some people might want the automatic check for too many
arguments, so we might see this as a bug report/feature request in the
future, and I wanted to know what reasons other people could see for
keeping the current behavior.

At the spot where this condition would be checked, perhaps we should
put a comment saying that the present behavior is intentional, so that
someone doesn't add it later in response to some feature request?

Thanks,

jwe


reply via email to

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