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

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

[Octave-bug-tracker] [bug #62639] inputParser fails to add Optional argu


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #62639] inputParser fails to add Optional argument with empty cell default value
Date: Tue, 21 Jun 2022 09:18:31 -0400 (EDT)

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

IIUC, this is an issue whenever the default value for an optional parameter is
a cell. (Not only for empty cells.)

An alternative (maybe less invasive) fix might be:

diff -r 05729b0e39e4 scripts/miscellaneous/inputParser.m
--- a/scripts/miscellaneous/inputParser.m       Mon Jun 20 17:27:39 2022 -0400
+++ b/scripts/miscellaneous/inputParser.m       Tue Jun 21 15:17:05 2022 +0200
@@ -275,6 +275,9 @@
                 "after Parameter or Switch"]);
       endif
       this.validate_name ("Optional", name);
+      if (iscell (def))
+        def = {def};
+      endif
       this.Optional{end+1} = struct ("name", name, "def", def, "val", val);
     endfunction
 



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62639>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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