You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Greg Mann (JIRA)" <ji...@apache.org> on 2016/07/13 18:09:20 UTC

[jira] [Comment Edited] (MESOS-5841) Clean up `FlagsBase::add`

    [ https://issues.apache.org/jira/browse/MESOS-5841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15375459#comment-15375459 ] 

Greg Mann edited comment on MESOS-5841 at 7/13/16 6:08 PM:
-----------------------------------------------------------

One option would be to get rid of all the overloads except for `FlagsBase::add(const Flag& flag)`, add a couple helper functions for modifying `Flag` objects, and construct flag objects in the 'flags.cpp' files:

{code}
Flag flag;
flag.name = "work_dir";
flag.help = help_string;
flag.set_storage(&Flags::work_dir); // New helper
flag.set_validation(lambda_function); // New helper
add(flag);
{code}


was (Author: greggomann):
One option would be to get rid of all the overloads except for `FlagsBase::add(const Flag& flag)`, add a couple helper functions for modifying `Flag` objects, and construct flag objects in the 'flags.cpp' files:

{code}
Flag flag;
flag.name = "work_dir";
flag.help = help_string;
flag.set_storage(&Flags::work_dir); // New helper
flag.set_validation(lambda_function); // New helper
{code}

> Clean up `FlagsBase::add`
> -------------------------
>
>                 Key: MESOS-5841
>                 URL: https://issues.apache.org/jira/browse/MESOS-5841
>             Project: Mesos
>          Issue Type: Improvement
>          Components: stout
>    Affects Versions: 1.0.0
>            Reporter: Greg Mann
>              Labels: mesosphere
>
> In the definition for {{FlagsBase}}, we currently have 20 overloads for the {{FlagsBase::add}} function. This makes both the {{FlagsBase}} class definition and the {{flags.cpp}} files in Mesos difficult to read. We should clean up {{FlagsBase::add}} so that it does not require so many overloads.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)