which of two ways to fix #45972 (saving anonymous fhs. with varargin)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

which of two ways to fix #45972 (saving anonymous fhs. with varargin)

Olaf Till-2

I'd like to submit a changeset for:


"Anonymous function handles with varargin are not correctly saved."

but would like to discuss which of two (?) ways to choose to fix it.

Anonymous function definitions are saved by using, among others, their
print method, which doesn't (but should (?)) print the 'varargin' in
the pararmeters, as you see here:

octave:1> @ (x, y, varargin) x + y + varargin{1}
ans =

@(x, y) x + y + varargin {1}

The print method uses the tree_print_code tree walker class to print
the parameters. Two ways to fix the print method are possible:

1. Handle printing of 'varargin' in the print method after printing
the parameters, or

2. handle printing of 'varargin' within the tree_print_code class
(method 'visit_parameter_list()').

The latter seems better to me. There is no method
'tree_print_code::visit_varargin()', so if this were not handled in
'tree_print_code::visit_parameter_list()', this tree walker couldn't
handle varargin at all (forcing handling of varargin outside the tree


public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

signature.asc (836 bytes) Download Attachment