money_get
's empty minus signSection: 28.3.4.7.2.3 [locale.money.get.virtuals] Status: NAD Submitter: Thomas Plum Opened: 2007-04-16 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [locale.money.get.virtuals].
View all issues with NAD status.
Discussion:
28.3.4.7.2.3 [locale.money.get.virtuals], para 3 says:
If
pos
orneg
is empty, the sign component is optional, and if no sign is detected, the result is given the sign that corresponds to the source of the empty string.
The following objection has been raised:
A
negative_sign
of "" means "there is no way to write a negative sign" not "any null sequence is a negative sign, so it's always there when you look for it".
[Plum ref _222612Y32]
[ Kona (2007): Bill to provide proposed wording and interpretation of existing wording. ]
Related to 669.
[ 2009-05-17 Howard adds: ]
I disagree that a
negative_sign
of "" means "there is no way to write a negative sign". The meaning requires the sentences of 28.3.4.7.2.3 [locale.money.get.virtuals] p3 following that quoted above to be taken into account:-3- ... If
pos
orneg
is empty, the sign component is optional, and if no sign is detected, the result is given the sign that corresponds to the source of the empty string. Otherwise, the character in the indicated position must match the first character ofpos
orneg
, and the result is given the corresponding sign. If the first character ofpos
is equal to the first character ofneg
, or if both strings are empty, the result is given a positive sign.So a
negative_sign
of "" means "there is no way to write a negative sign" only whenpositive_sign
is also "". However whennegative_sign
is "" andpostive_sign.size() > 0
, then one writes a negative value by not writing thepostive_sign
in the position indicated bymoney_base::sign
. For example:pattern = {symbol, sign, value, none} positive_sign = "+" negative_sign = "" $123 // a negative value, using optional sign $+123 // a positive value $-123 // a parse errorAnd:
pattern = {symbol, sign, value, none} positive_sign = "" negative_sign = "" $123 // a positive value, no sign possible $+123 // a parse error $-123 // a parse errorAnd (regarding 669):
pattern = {symbol, sign, value, none} positive_sign = "-" negative_sign = "-" $123 // a parse error, sign is mandatory $+123 // a parse error $-123 // a positive valueThe text seems both unambiguous and clear to me. I recommend NAD for both this issue and 669. However I would have no objection to adding examples such as those above.
[ Batavia (2009-05): ]
This discussion applies equally to issue 669 (q.v.). Howard has added examples above, and recommends either NAD or a resolution that adds his (or similar) examples to the Working Paper.
Alan would like to rewrite paragraph 3.
We recommend moving to NAD. Anyone who feels strongly about adding the examples is invited to submit corresponding wording. We further recommend issue 669 be handled identically.
[ 2009-07-14 Alan reopens with improved wording. ]
[ 2009-07 Frankfurt ]
No consensus for closing as NAD. Leave in Review.
[ 2009-10 Santa Cruz: ]
NAD. Agreed that the original assessment as NAD was correct.
Proposed resolution:
Change 28.3.4.7.2.3 [locale.money.get.virtuals] p3:
-3-
If the first character (if any) in the string pos returned byThe sign pattern stringsmp.positive_sign()
or the stringneg
returned bymp.negative_sign()
is recognized in the position indicated by sign in the format pattern, it is consumed and any remaining characters in the string are required after all the other format components. [Example: Ifshowbase
is off, then for aneg
value of "()" and a currency symbol of "L", in "(100 L)" the "L" is consumed; but ifneg
is "-", the "L" in "-100 L" is not consumed. -- end example] Ifpos
orneg
is empty, the sign component is optional, and if no sign is detected, the result is given the sign that corresponds to the source of the empty string. Otherwise, the character in the indicated position must match the first character ofpos
orneg
, and the result is given the corresponding sign. If the first character ofpos
is equal to the first character ofneg
, or if both strings are empty, the result is given a positive sign.pos
andneg
are returned bymp.positive_sign()
andmp.negative_sign()
respectively. A sign pattern is matched if its first character is recognized ins
in the position indicated bysign
in the format pattern, or if the pattern is empty and there is no sign recognized ins
. A match is required to occur. If both patterns are matched, the result is given a positive sign, otherwise the result is given the sign corresponding to the matched pattern. If the pattern contains more than one character, the characters after the first must be matched ins
after all other format components. If any sign characters are matched,s
is consumed up to and including those characters. [Example: Ifshowbase
is off, then for aneg
value of "()
" and a currency symbol of "L
", in "(100 L)
" the entire string is consumed; but for aneg
value of "-
", in "-100 L
", the string is consumed through the second "0
" (the space and "L
" are not consumed). — end example]