bugGNU Octave - Bugs: bug #34857, feval() version that takes...

 
 

bug #34857: feval() version that takes arbitrary length argument list

Submitter:  Patrick Gosling <jpmg>
Submitted:  Fri 18 Nov 2011 02:56:13 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.3 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Nov 2011 03:51:36 PM UTC, comment #3: 

No problem.

John W. Eaton <jwe>
Group administrator
Fri 18 Nov 2011 03:37:19 PM UTC, comment #2: 

I'm embarrassed now (and slightly confused as to how I convinced myself this didn't work).

Apologies!  [ and thank you very much for the reply ]

Patrick Gosling <jpmg>
Fri 18 Nov 2011 03:27:29 PM UTC, comment #1: 

Is there some reason that


args = {cell, array, of, arguments}'
feval (f, args{:})


won't work for you?

John W. Eaton <jwe>
Group administrator
Fri 18 Nov 2011 02:56:13 PM UTC, original submission:  

When attempting to marshall a call to feval(), it is often the case that the length of the argument list being presented is not known until run time. 

Currently, the only way I can see of addressing this is to switch with a case for each plausible number of arguments, but that is clearly very unsatisfactory.

An enhancement would be to either

a) have a variable-arguments version called perhaps va_feval() or vfeval() or similar, which would take two arguments - a function handle, and a cell array containing the arbitrary length argument list to be passed to the called function.

b) have a special case for feval(), where if it was passed exactly two arguments and the second argument was a cell array, that it was assumed that the cell array should be treated as the argument list for the function called.

The latter is tempting (in terms of avoiding duplicating code within the octave interpreter), but is not backwards compatible, and breaks compatibility with matlab.

Implementation in either case is fairly straightforward (I'd be happy to do the necessary).


Patrick Gosling <jpmg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jpmg (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-18 jwe StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code