stevedlawrence opened a new pull request, #1139:
URL: https://github.com/apache/daffodil/pull/1139

   > [!NOTE]
   > This is an alternative approach to #1138, which does feel like a bit of a 
hack and does not support other padding styles. Like that one, I've marked this 
as an RFC/Draft since it uses behavior not specified by the DFDL specification 
and gives meaning to something ICU normally ignores.
   >
   > In the previous PR, there was some discussion about making the negative 
pattern mean something more. Although DAFFODIL-2870 suggests we shouldn't do 
that, I think this use is small enough that it is potentially acceptable. It 
also doesn't require changes to Daffodil parsing/unparsing (with possible 
performance implications) or extension properties mentioned in the other PR 
(e.g. 
`dfdlx:textNumberPositivePatttern`/`dfdlx:textNumberNegativePattern`/`dfdlx:icuPadPosition`).
 We definitely do need to be careful about what, if any, meaning we extract 
from normally ignored parts of the negative pattern, but the pad position seems 
like a reasonable exception to me considering possible ambiguities with the 
positive pattern.  
   
   ICU only uses the positive pattern of the textNumberPattern property to 
determine pad character and position, completely ignoring the negative pattern. 
If the positive pattern has no affix associated with the pad character, then 
there is an ambiguity if the pad character should appear before or after the 
negative affix when unparsing negative numbers. In this case, ICU defaults to 
before the affix, with no way to change it via the pattern. This effectively 
means it is not possible for ICU number padding to appear after a negative 
affix if there is no positive affix.
   
   To resolve this ambiguity and allow configuring where pad characters appear, 
we inspect the negative pattern. If both negative and positive patterns define 
padding on the same affix, and the positive pattern has an empty string for 
that affix, then we use the pad position from the negative pattern. In all 
other cases, the pad character in the negative pattern is ignored following 
usual ICU behavior.
   
   For example, a textNumberPattern of "*0####0;-*00" formats a negative number 
with zero padding after the hyphen, whereas normal ICU behavior would ignore 
the negative pattern and zero pad before the hyphen.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to