Gaps between specification and implementation in typed_value::composing()
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with src/variables_map.cpp in Boost 1.81.0, especially the first parsed-options loop at lines 48-93 and the xm.m_final update at line 102. Reproduce the single-store and repeated-store cases using the linked Wandbox examples, with and without composing(). Done means determining whether Example 63.2, its documentation, or the implementation is inconsistent and clearly documenting the conclusion.
Written by the indexing model from the issue text.
Description
Description and Reproduction
Consider Example 63.2 (Execution on Wandbox)
test --phone 123 --phone 456
In this case, both phone numbers, 123 and 456, are parsed. The call to composing() makes it possible to use a command-line option multiple times – the values are composed.
From this description, it would seem that, conversely, without the call to composing(), only 123 would be assigned to the --phone option but 456 would be ignored. (I assume this is the specification. Is my understanding correct?)
- It seems that there are others who have a similar understanding:
However, even after removing composing(), both 123 and 456 are assigned to --phone. (Execution on Wandbox)
On the other hand, in order to confirm the effect of composing() in the current implementation, when store() is called twice, we can see that the result changes depending on whether composing() is called or not.
- Twice
store()withcomposing(): Execution on Wandbox - Twice
store()withoutcomposing(): Execution on Wandbox
Implementation Analysis
From what I've seen of the implementation of Boost 1.81.0, these lines are suspect.
- In the first for loop to proceed the parsed options (L48-L93)
- After the first for loop,
xm.m_finalis modified bynew_final(L102)
The intuitive image from the description of Example 63.2 is an implementation in which:
- Deleting L102.
- Modifying L91 to
xm.m_final.insert(option_name)
Summary
- There seems to be a gap between the specification (which I can intuitively read from Example 63.2) and the implementation.
- I would like to clarify if my understanding is wrong or if either the description of Example 63.2 or implementation is incorrect.
Version
- Boost 1.81.0
- Dominant language
- C++
- Stars
- 136
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/program_options
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/program_options#147 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
boostorg/program_options#146 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
boostorg/program_options#144 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
boostorg/program_options#142 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
boostorg/program_options#139 ·
All issues in boostorg/program_options
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·