octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #32700] nargout(fn) Matlab compatibility


From: anonymous
Subject: [Octave-bug-tracker] [bug #32700] nargout(fn) Matlab compatibility
Date: Thu, 10 Mar 2011 21:29:22 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15

Follow-up Comment #3, bug #32700 (project octave):

(Iain here again.) Thanks for the pointers. I've attached (hopefully
correctly) an hg changeset including a very similar fix for `nargin', with
exactly the same motivation.

Personally I would wait for someone to express a need before making intrusive
changes to Octave to make nargin/nargout work on builtins. Certainly it won't
come up in the use-case I was interested in. Also as I stated before, Matlab
has functions (well, at least `histc') which don't work in nargin/nargout.


Here is a demo of the new behavior of nargin:

octave:1> nargin(@()1)
ans = 0
octave:2> nargin(@(x)1)
ans =  1
octave:3> nargin(@(x,y)1)
ans =  2
octave:4> nargin(@(x,y,varargin)1)
ans = -3
octave:5> nargin(@(varargin)1)
ans = -1
octave:6> nargin(inline('1'))
ans = 0
octave:7> nargin(inline('1','x'))
ans =  1
octave:8> nargin(inline('1','x','y'))
ans =  2
octave:9> nargin(inline('1','x','y','varargin'))
ans = -3
octave:10> nargin(inline('1','varargin'))
ans = -1
octave:11> nargin(@histc)
ans =  3
octave:12> nargin(@sin)
error: nargin: nargin information not available for builtin functions
octave:13> (@(x,y,z) nargin)(1,1,1)
ans =  3
octave:14> (@(x,y,z,varargin) nargin)(1,1,1)
ans =  3
octave:15> (@(x,y,z,varargin) nargin)(1,1,1,1)
ans =  4


(file #22891)
    _______________________________________________________

Additional Item Attachment:

File name: nargin_nargout.diff            Size:7 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32700>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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