help-octave
[Top][All Lists]
Advanced

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

Re: Too many arguments?


From: Jaroslav Hajek
Subject: Re: Too many arguments?
Date: Thu, 6 Aug 2009 12:10:55 +0200

On Thu, Aug 6, 2009 at 4:23 AM, John W. Eaton<address@hidden> wrote:
> On  5-Aug-2009, Olaf Till wrote:
>
> | On Tue, Aug 04, 2009 at 03:45:55PM +0200, Carlo de Falco wrote:
> | > FWIW Octave 3.2.2 still accepts extra arguments without complaining.
> | > I have no idea whether or not this will still be the case in the future...
> | > c.
> |
> | Thanks anyway! Olaf
>
> I don't remember exactly why I chose to make Octave silently accept
> extra arguments.  Maybe I didn't have an easy way to implement this
> feature at the time.
>
> In any case, some people might think this difference with Matlab is a
> minor bug.  It would probably not be hard to make Octave generate an
> error in this case, so it might happen in the future.  If you don't
> want that, then can you explain clearly why it makes sense for Octave
> to silently accept extra arguments that are not used?
>

just my 4 cents :)

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.
2. Excess output arguments are also ignored silently (is this the same
in Matlab?).
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.
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.

cheers

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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