ICU D Wrapper
Trent Forkert via Digitalmars-d
digitalmars-d at puremagic.com
Fri Dec 12 09:57:39 PST 2014
On Friday, 12 December 2014 at 16:51:43 UTC, Jake wrote:
> I'm not sure if anyone has noticed, but the D wrapper for C's
> ICU library is far from working it seems. mango.icu is its
> technical name. I've read articles on the forum about how
> excited people were to get ICU usable in D, but whoever made
> mango.icu hasn't made any updates on it or even documented it
> online.
>
> I'm just letting you all know about this. D seems to already
> have a bunch of ICU's functionality though, so maybe the
> wrapper died on purpose. I really just wanted to use its time
> zone and date features since std.datetime doesn't make it very
> easy to use the TZ database on Windows.
I've looked into writing a binding for ICU recently, but
ultimately decided to abandon that idea in favor of writing a
replacement for it in D.
The reasons for this are:
* ICU breaks its ABI with every release, meaning a D binding
would only work for one version of ICU, and need pragma(mangle)
to have a hope of easy updating. Alternatively, what mango.icu
seems to have done is load ICU at runtime in order to figure out
what library to bind
* ICU's data and APIs use UTF-16. I'd rather everything be UTF-8.
* ICU's API is incredibly inconvenient for (if not impossible to
access from) D. For example, some of the functionality requires
binding C++ classes that use multiple inheritance
* A decent chunk (though not all) of ICU is actually generated
from CLDR, meaning I can do the same
It looks to me like mango.icu hasn't updated since ICU v38 (it is
up to v54 now), and made extensive use of wrappers in order to
hide the C-API nastiness. It also doesn't support any of the
functionality that requires C++. Binding ICU would be very nice,
but this is one of the few cases I actually think we'd be better
off rolling our own.
I'm still a little ways off from having my work ready for public
release, but I've been making good progress recently.
If you can point out what ICU API you need, I'll make sure to
included equivalent API in my library.
- Trent
More information about the Digitalmars-d
mailing list