Re: ICU4 API proposal: sprintf/scanf-like support in formatters

"Edward J. Batutis" <[email protected]> Thu, 12 Feb 2004 12:27:50 -0800 (PST)
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
--- George Rhoten <[email protected]> wrote:
> This seems like a lot of duplication of effort.

Not at all. It took me a couple of hours to fully
implement it.

> If you want a full POSIX 
> formatting pattern, why not just extend the current
> icuio library. 

I don't want to use printf. I like MessageFormat. I
stated that in my proposal. Also, the icuio code is
not supported. I don't intend to take on that effort.

> For the C++ formatting API, I was thinking more of
> something like the JDK 1.5..

This is the POSIX printf spec, but they left out
support for formatting unsigned integers and some
other non-Java-like things - things that I need. As I
said, I prefer the MessageFormat mechanism. I imagine
you all will be porting this printf-thing from Java,
in which case, great - I can call the code in my
MessageFormat-related scanf/printf-like format class.
Now I use the platform facilities.

> Creating a new formatting specification, as you
> proposed it, would create yet another mutant 
> formatting spec. 

I don't follow you at all - the scanf/printf
formatting spec is a totally mutant spec, but that's
reality. I'm porting code here so I don't care. I just
added a minor bit of interfacing to that. I didn't
create a 'spec' worth worrying about.

> ... not to create a new 
> format for everyone to learn.
 
What's to learn?

Anyway, I've finished my implementation and I've
decided that this not quite the best thing:

> {0, number, fpattern, %8u} ..
> {1, string, fpattern, %-10s} ..

but this is better:

{0, pattern, %8u} ..
{1, pattern, %-10s} ..

etc. The pattern fully defines the type, so this is
all that is needed. 

That was really easy to implement. It's done and now
my porting work is much easier. The MessageFormat code
was designed to be extensible, and it was easy to
extend. I have a perl script to convert the messages
to this new format, and I'm just about finished.
Whoever wrote MessageFormat: thanks!

Regards,

=Ed


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html