octave-maintainers
[Top][All Lists]
Advanced

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

Re: Default arguments


From: John W. Eaton
Subject: Re: Default arguments
Date: Thu, 14 Dec 2006 20:19:03 -0500

On 14-Dec-2006, Andreas Romeyke wrote:

| - From maintenance point of view default arguments are a horrible
| scenario. Because it hides semantics I would not agree with you that
| Octave (or any language, too) should support this.

We already have default values for arguments for many functions, so
it's a little late to say that the language should not support them.
Currently, you have to write something like

  function foo (arg)
    if (nargin < 1)
      arg = 42;
    end
    ...

which is somewhat verbose and easy to screw up.  Wouldn't it be better
to be able to write

  function foo (arg = 42)
    ...

instead?

jwe


reply via email to

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