bugGNU Octave - Bugs: bug #45367, addParameter and partial matching...

 
 

bug #45367: addParameter and partial matching for inputParser

Submitter:  None
Submitted:  Sun 21 Jun 2015 09:02:58 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Laurent Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  9.1.0
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 19 Apr 2023 11:09:04 PM UTC, comment #10: 

This was fixed in cset 80fef9315743 (bug #64050).  Closing report.

Rik <rik5>
Group administrator
Tue 25 Oct 2016 08:41:21 PM UTC, comment #9: 

Ping!

The first half of this report, adding the addParameter method to inputParser, has been done.

The second half, implementing PartialMatching, has not been done in part because the code changes necessary were not presented in a Mercurial changeset format, or at the very least a diff, so that we could accurately understand what was happening.

If the original poster could submit a changeset or diff with the PartialMatching support the Octave devs can review and finish this issue report.

Rik <rik5>
Group administrator
Sat 02 Jul 2016 02:09:40 AM UTC, comment #8: 

Retagging as "In progress".

Lachlan Andrew <lachlan>
Thu 05 May 2016 04:45:05 PM UTC, comment #7: 

That seems like a very bad reason to change recommend against the use of addParamValue. Anyway, then let's get this things merged one at a time.

I have added the addParameter method without the PartialMatching option.  The submitted file was incorrect because it assumes that a validator argument must be submitted before the PartialMatching option.  Matlab documentation suggests that the validator is optional. I have submitted a modified  http://hg.savannah.gnu.org/hgweb/octave/rev/1cd04fb745f6 that does the input check but does not yet does anything yet.

If you could submit a cset instead of a modified version of an old mfile that would help to move this faster.

Carnë Draug <carandraug>
Group Member
Thu 05 May 2016 11:29:57 AM UTC, comment #6: 

I wrote the original patch and have quite some codebase in Matlab. In my code I replaced all occurences of addParamValue with addParameter and never had any issues. Thus, it seems that whatever worked with addParamValue, will also work with addParameter in an identical way.

Besides, the autocorrector in Matlab suggests to replace addParamValue with addParameter without changing anything else on its input variables. So it really seems that addParameter is an alias for addParamValue with an additional option.

Regards,
Laurent

Anonymous
Wed 04 May 2016 03:34:52 PM UTC, comment #5: 

Like you, I do not see any difference in the doc.
If the behaviour was really different, they should have given informations to ease the migration to the new, recommended, function.

Perhaps they just found that "addParamValue" was an ugly name.

ederag <ederag>
Wed 04 May 2016 02:57:09 PM UTC, comment #4: 

I was not very clear the first time.

In this patch, the addParameter option is pretty much an alias for addParamValue and only has an extra option at the end for PartialMatchPriority. Is it true that Matlab really behaves that way?

If I was doing this myself at Mathworks, and the only difference was an extra option at the end, I could just add that extra option to addParamValue.  The new extra option would still be backwards compatibility. To me, that suggests that AddParamValue and addParameter must behave somewhat different internally otherwise the deprecation of addParamValue makes no sense.

The problem is that I can't see what the difference is from their help text. And if it is true that they behave different in some way, then the patch is incorrect and addParameter needs to be implemented different than addParamValue.

Carnë Draug <carandraug>
Group Member
Wed 04 May 2016 11:44:41 AM UTC, comment #3: 

@carandraug

The proposed function seems useful
especially since addParamValue is "not recommended".
http://fr.mathworks.com/help/matlab/ref/inputparser.addparamvalue.html

But there would be no harm to have "PartialMatching" for addParamValue as well. Your choice.

ederag <ederag>
Sun 21 Jun 2015 05:38:44 PM UTC, comment #2: 

Hi,

my goal was to be matlab compatible. If I understand their documentation correctly, then the partial matching with priority is only available for addParameter. addParamValue only allows a partial matching without priority. Except for this difference both methods should behave identically in Matlab.

Regards,
Laurent

Anonymous
Sun 21 Jun 2015 12:24:50 PM UTC, comment #1: 

So is there any difference between addParameter and addParamValue? From your patch it seems that Parameter simply adds an extra option "PartialMatching". Why not have it for ParamValue as well?

Carnë Draug <carandraug>
Group Member
Sun 21 Jun 2015 09:02:58 AM UTC, original submission:  

The inputParser class in octave is missing the addParameter method recently introduced in Matlab. In addition, partial matching is not implemented.

The attached file adds these two features with additional tests.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34282:  inputParser.m added by None (30KiB - text/x-objcsrc)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by ederag (Posted a comment)
  • -email is unavailable- added by None (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-19 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 9.1.0
    2020-12-02 mmuetzel Release4.0.0 dev
    2016-10-25 rik5 Dependencies- bugs #49364 is dependent
    2016-07-02 lachlan StatusPatch Submitted In Progress
    2015-06-21 rik5 Carbon-CopyRemoved 72865 -
    2015-06-21 rik5 StatusNone Patch Submitted
    2015-06-21 None Attached File- Added inputParser.m, #34282

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code