octave-maintainers
[Top][All Lists]
Advanced

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

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


From: Olaf Till
Subject: which of two ways to fix #45972 (saving anonymous fhs. with varargin)
Date: Tue, 15 Sep 2015 22:56:13 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Hi,

I'd like to submit a changeset for:

https://savannah.gnu.org/bugs/index.php?45972

"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
walker).

Olaf

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

Attachment: signature.asc
Description: Digital signature


reply via email to

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