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

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

[Octave-bug-tracker] [bug #45972] Anonymous function handles with vararg


From: Olaf Till
Subject: [Octave-bug-tracker] [bug #45972] Anonymous function handles with varargin are not correctly saved.
Date: Tue, 15 Sep 2015 20:38:13 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.8.0

URL:
  <http://savannah.gnu.org/bugs/?45972>

                 Summary: Anonymous function handles with varargin are not
correctly saved.
                 Project: GNU Octave
            Submitted by: i7tiol
            Submitted on: Tue 15 Sep 2015 08:38:12 PM GMT
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Olaf Till
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Anonymous function handles using varargin are not correctly saved and thus
can't be reloaded. Example:


octave:1> a = @ (varargin) varargin{1}
a =

@() varargin {1}

octave:2> a (1)
ans =  1
octave:3> save ("test.dat", "a")
octave:4> load ("test.dat")
octave:5> a (1)
error: 'varargin' undefined near line 1 column 5
error: called from
     at line -1 column -1
error: evaluating argument list element number 1
error: called from
     at line -1 column -1
octave:5> 


It's the same for saving in binary or hdf5 format. The reason is that the
function definition is saved with

ov-fcn-handle::print_raw()

, which doesn't print the 'varargin' (as you also see above).

I'd like to make a changeset for fixing

ov-fcn-handle::print_raw()

, it's not difficult, but there are two possibilities:

1. adding printing of 'varargin' directly in

ov-fcn-handle::print_raw()

after printing the parameter list,

or

2. handling printing of 'varargin' within the printing of the parameter list,
i.e. in

tree_print_code::visit_parameter_list()


I'd vote for 2., but I'll ask at the maintainers list before submitting a
changeset.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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