post_review_plan.txt 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. Program options post-review development plan.
  2. 0. Convert all documentation to BoostBook format
  3. 1. (done)
  4. Simplify and clarify interface.
  5. It turns out that most users are interested in 'variables_map' class, so
  6. it must be possible to use it directly, without even knowing about
  7. 'options_and_arguments'. The proposed interface is:
  8. options_description desc;
  9. ....
  10. variables_map vm;
  11. load_from_command_line(vm, desc, argc, argv);
  12. 2. (done)
  13. Better separation of syntaxic and semantic processing, as suggested by
  14. Pavol Droba.
  15. The problem with current 'option_description' interface is that the
  16. 'validator' and 'notifier' callbacks are not really usable by ordinary
  17. users --- it's extender's interface. The current 'parameter' function uses
  18. those callback to provide user-friendly semantic interface, but it's not
  19. documented nor completely worked out.
  20. In the new interface, the second parameter of 'option_description' ctor
  21. will have two possibilities: just a string and a pointer to a new class
  22. 'value_descriptor'. When passed the latter, it will invoke the instance on
  23. itself, and then delete the object. A function 'value' will be provided,
  24. that will create value specific for a type.
  25. Example
  26. ("magic", value<int>("n", &n)->default_value(10), "magic value").
  27. The 'value' function will create instances of 'typed_value_descriptor'
  28. type, with the following methods:
  29. - default_value
  30. - interpreter
  31. - validator
  32. - notifier
  33. The 'option_description' class we'll have two attributes to support
  34. semantic operation: 'generator', which will handle conversion from string
  35. into value (including application of default value), and 'notifier'. Similiar
  36. to the the current design, those attributes will be set by
  37. 'value_descriptor' instances.
  38. Another function, "bool_switch" will create value descriptor for type bool,
  39. with default value of false. The function is needed to avoid special-casing
  40. 'value' function on bool type, which was considered confusing (Neal D. Becker).
  41. 3. (done) Support for positional options.
  42. Positional options will be treated uniformly with ordinary ones. User will
  43. be able to specify that, for example, third positional option is to be
  44. interpreted as option "output-file" with the same value.
  45. The user interface will be simple: user will provide two instanes of
  46. 'options_description' to functions which parse command line. For example.
  47. options_description desc;
  48. desc.add_options()
  49. ("magic", "n", "magic value")
  50. ;
  51. options_description pdesc;
  52. pdesc.add_options()
  53. ("output-file", "n", "output file")
  54. ("input-files*", value< vector<string> >("n"), "files")
  55. ;
  56. variables_map vm;
  57. load_from_command_line(vm, desc, pdesc, argc, argv);
  58. 4. (done, except for registry)
  59. Multiple sources improvement.
  60. Need to implement support for registry/environment.
  61. Also, must devise a way to handle different naming of option in
  62. sources. Lastly, the storing of values into program variables should
  63. become part of 'variables_map' interface.
  64. 5. Improve documentation.
  65. Chuck Messenger:
  66. "When code is given for an example program, after the code, give examples of
  67. using the program, along with the expected output."
  68. Pavol Droba:
  69. "I would prefer a few chapters explaining various components of the
  70. library, each followed by a reference."
  71. Pavel Vozenilek:
  72. > Documentation should contain list of compilers the library works on and
  73. > also info whether MSVC 6 port is feasible or not.
  74. >
  75. > The non-Doxygen part of documentation can be also a bit expanded: e.g. I
  76. > would welcome some high level overview of the algorithms and structures and
  77. > info about expected CPU/memory consumption.
  78. >
  79. > Also info whether there are any internal limits (like option length) .
  80. >
  81. > Some examples may be bit more annotated, also contain what is expected
  82. > output.
  83. Syntax highligting.
  84. Document "*" in option names
  85. Automated tests for examples?
  86. (new) Comments inside code snippets?
  87. (new) Table of all symbols
  88. 6. (deferred)
  89. Unicode support
  90. - unicode in argv/argc
  91. - Unicode in config files not supported
  92. (
  93. The difference between ASCII and unicode files is:
  94. - big endian UTF16 starts with 2 bytes FE FF 9mandatory by Unicode
  95. standard) - little endian UTF16 starts with FF FE
  96. - UTF8 text starts with EF BB BF
  97. Pavel Vozenilek
  98. )
  99. 7. Config file improvements
  100. - should have "allow_unregistered" for config_file.
  101. - (done) bool options in config file do not work.
  102. - "#" inside strings, in config files (Pavel Vozenilek)
  103. 8.
  104. Cmdline improvements
  105. - must be able to parse WinMain string
  106. - support for response files
  107. 9. Other changes.
  108. - (outdated) get_value -> value (Beman)
  109. - (done) is "argv" const in std, or not? Adjust docs if not.
  110. - variables_map::count_if, find_if (Tanton Gibbs)
  111. - Works with exceptions disabled.
  112. - (outdated) disallow empty name for the 'parameter' function
  113. - check for prefixes if 'allow_guessing' is on
  114. - check for duplicate declaration of options.
  115. - test additional parser
  116. - Show default values in help output
  117. - Adaptive field width
  118. - Mandatory options (2 votes (second Jonathan Graehl))
  119. - (new) return vector from parsers by auto_ptr, not by value?
  120. - (new) rename value_semantic into value_description
  121. - (new) output for positional_options_description
  122. - (new) variables_map should throw when value not found
  123. - (important) decide where we check that the number of passed option
  124. tokens is less than the allowed number. In parser or later?
  125. - (important) what if the same option has different definitions?
  126. - (new) We lost the ability to specify options_description instance
  127. in call to 'store'. So now we can't store just subset of options.
  128. Is it a problem?
  129. - (new) Improve formatting of 'arg'.
  130. - (new) revive real and regexp examples.
  131. - (new) even more simpler syntax for assignent to var?
  132. 10. Uncertain
  133. - Function to get program name
  134. - Order of 'description' and 'value'.
  135. 11. (new) Look at all "TODO" comments.
  136. (new) Check that all methods are documented.
  137. 12. Deferred
  138. - setting a flag when option is found