From: <yos...@us...> - 2011-09-21 19:51:08
|
This API proposal was REJECTED by ICU PMC on 2011-09-21, because of backward compatibility concerns. Instead - 1) Make these methods “actually” const (cloning calendar) - Peter will file a bug to fix this 2) Peter will propose new APIs - non-const formatter/parser later -Yoshito Peter Edberg <pe...@ap...> wrote on 09/14/2011 09:27:15 PM: > From: Peter Edberg <pe...@ap...> > To: icu...@li... > Date: 09/14/2011 09:28 PM > Subject: [icu-design] Remove "const" from UDateFormat* param in > udat_parse, udat_format > > ticket: http://bugs.icu-project.org/trac/ticket/8269 > Designated reviewer: Markus > Please provide feedback by: Wednesday Sept. 21 > > Currently the C date format & parse functions are specified as follows: > > int32_t udat_format (const UDateFormat *format, UDate > dateToFormat, UChar *result, > int32_t resultLength, UFieldPosition *position, > UErrorCode *status) > > UDate udat_parse (const UDateFormat *format, const UChar *text, > int32_t textLength, > int32_t *parsePos, UErrorCode *status) > > However, the use of "const" with the UDateFormat* parameter for > these functions is an error (these functions update the Calendar > associated with the DateFormat to which the UDateFormat* refers). > Per discussion in the ICU meeting of 2011-01-05 on documentation of > thread safety (per http://bugs.icu-project.org/trac/ticket/8202), > the "const" should be removed from the above: > > • Removing it is binary-compatible but will cause compile errors. > • This change should be mentioned in the Readme file and download > page for the ICU release that includes it. > • Note that the alternative of retaining the "const" and instead > using a mutex lock could cause deadlocks. > > Should we also consider removing the "const" from the C++ DateFormat > methods called be the above functions (and perhaps other DateFormat > methods for which it is erroneous) ?: > > UnicodeString & format (UDate date, UnicodeString &appendTo, > FieldPosition &fieldPosition) const; > > UDate parse (const UnicodeString &text, ParsePosition &pos) const; > > The format method updates the Calendar associated with the > DateFormat to the specified date. The parse method updates the > associated Calendar's date to the parsed date, and may also update > the Calendar's TimeZone. > > - Peter E > |