unitsofmeasurement / indriya

JSR 385 - Reference Implementation
Other
122 stars 42 forks source link

Could we use Apache Commons Numbers instead of types like RationalNumber? #254

Closed keilw closed 3 years ago

keilw commented 5 years ago

While Apache Commons Numbers has not released its 1.0 version and there is a bit of slow activity in recent months, it seems Fraction or BigFraction in particular covers most of what RationalNumber does here. Could we use it and (where contributors like @andi-huber were happy to help) maybe offer improvements or actual code contribution to the Commons Numbers project instead?

keilw commented 5 years ago

I'm afraid this is too early for OC1, there is no official release of Commons Numbers as of now.

teobais commented 5 years ago

Wow, I was again in a rush and read "has not released any newer version after 1.0" instead; I should stop checking issues in the middle of the night 😂

Cool, reverted everything!

keilw commented 5 years ago

For the really daring who know a bit about OpenJDK you could have a look at this branch https://github.com/unitsofmeasurement/indriya/tree/multi_release_jar and https://github.com/unitsofmeasurement/indriya/issues/25 if you like at OC1.

frothga commented 4 years ago

If Apache Commons Numbers is lightweight and self-contained, that's great. But please avoid bloating any final distribution that depends on UoM. IE: please weigh the number of additional jars and added megabytes of payload against the benefit.

keilw commented 4 years ago

It's still in snapshot, so don't worry about it. Not sure, how active it is because even the last 1.0-SNAPSHOT binaries are unavailable at Apache, so while there is a lot of activity and it seems a beta-1 is in the making soon, let's wait till a binary was released either to download at Apache or a Maven repository. Commons CVS 1 is just 35kB in JAR size, Commons Math 3 over 2MB, I would not seriously consider a JAR that is much bigger than Indriya itself which is currently around 250kB. With at least a few dependencies like uom-lib-common also just around 25kB at the moment.

andi-huber commented 4 years ago

Should there ever be a release of Apache Commons Numbers, we could provide a new (optional) maven artifact that provides just another NumberSystem implementation that integrates with Apache Commons Numbers.

This would not bloat UoM dependencies, while giving people the freedom of choice on which NumberSystem they prefer to use.

keilw commented 4 years ago

We could do this via some SPI mechanism yes, that's a good idea. AFAIR at least NumberSystem is already part of the Indriya SPI.

keilw commented 4 years ago

I am currently working on Eclipse UOMo to get versions 0.8 and 1.0 out soon. Hoping 1.0 might graduate it from the Incubator. The focus in 0.8 is UCUM also because that is very important for HL7 and medical research (including Corona) but for 1.0 I also hope to add ICU and ICU4J because that is very big under Eclipse. And build a "bridge" from our UoM extension module "Unicode CLDC" to ICU4J but as a separate module or bundle, because ICU4J is roughly 20 MB in size ;-)

keilw commented 4 years ago

The Commons Number project released a 1.0.0-beta1 to MavenCentral, so it could also be used for experiments if we consider using it.