octave-maintainers
[Top][All Lists]
Advanced

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

Re: Expected behavior for variables which shadow function names


From: John W. Eaton
Subject: Re: Expected behavior for variables which shadow function names
Date: Thu, 07 Mar 2013 14:13:09 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

On 03/07/2013 02:04 PM, Rik wrote:

I would definitely prefer that.  Can someone verify on a recent version of
Matlab how this behaves?  If they have upgraded their behavior then we can too.

Some things to test:

  function f (jet)
    jet
  end

  function f (jet)
    if (nargin == 0)
      jet
    elseif (nargin == 1)
      x = jet
    end
  end

call both with

  f (1)
  f (0)

Another:

  function f ()
    jet = 1;
    clear jet
    jet
  end

Not that it would be very hard to fix, but I hope there isn't any code in Octave that actually depends on the current behavior...

jwe



reply via email to

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