[gmx-developers] Selection default options

Teemu Murtola teemu.murtola at gmail.com
Tue Aug 13 20:59:29 CEST 2013

On Tue, Aug 13, 2013 at 5:31 PM, Anders Gärdenäs
<anders.gardenas at gmail.com>wrote:

> The purpose of the option is to always get all the coordinates (from a pdf
> or a trajectory file).

If you always want to get all the coordinates, what's the point of a
user-visible option and all the complexity the selections bring? Why not
simply use the atom coordinates directly?

> So are there any other options that will behave in the same whey where
> there is a default option?

For all the other option types, it is possible to provide a simple default
value, so the selection options are unique in this sense. The main
difference, as I already said, is that it is difficult to arrange it such
that the default selection text could be parsed at the time the option is
declared. For all other option types currently there, it is close to
trivial to provide a default value that just gets interpreted at the time
the option is declared.

> If there aren’t will I try to implement an option like:
> defaultSelectionText(“…”); if there is does it depend how much time I got
> (I am working here as a summer job ) and what my supervisors wants.

Just let me know whether you will, so that we can avoid duplicate work.

> If I implement it isn’t smarter to make it “universal” so it works for
> every option instead of only Selection, it might come handy for other types
> of options?

I suspect that it will create more confusion than it is worth to be able to
say "IntegerOption(...).defaultText("1")", and have that "1" parsed into an
integer at some later time... But that said, it _may_ be beneficial to add
some code into the core option implementation to make this easy to
implement also for other types of options. It really depends on whether
there is some synergy with the current approach to default values: If the
new implementation doesn't allow simplifying anything in the existing code,
then it probably makes the internal option logic more convoluted, and
doesn't really improve the code.

> I don’t rely know how it shod behave with or without required(),
> nevertheless I guess it shod work like the rest of the default options.

Currently, specifying .defaultValue() essentially makes .required() a
no-op. That may be reasonable here as well.

>   –select without a value shod probably work as before, (triggers an
> interactive prompt )  even if there is a default text.

Sounds reasonable.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20130813/bb38d685/attachment.html>

More information about the gromacs.org_gmx-developers mailing list