Skip to content

refactor!: remove deprecated divisionPolicy config and averageDeci#5

Merged
diogocavaiar merged 2 commits into
mainfrom
chore/0.3.0-cleanup
Jun 9, 2026
Merged

refactor!: remove deprecated divisionPolicy config and averageDeci#5
diogocavaiar merged 2 commits into
mainfrom
chore/0.3.0-cleanup

Conversation

@diogocavaiar

Copy link
Copy Markdown
Member

Summary

Removes the deprecated division-policy configuration and the deprecated averageDeci extension from the public
API. This is a breaking removal, so the library is bumped to 0.3.0.

  • Deleted DeciConfiguration.divisionPolicy, DeciConfiguration.resetDivisionPolicy(), and the
    DeciDivisionPolicy class. The / operator no longer reads a global mutable policy — it now always divides
    with DeciContext.DEFAULT (20 fractional digits, HALF_UP), which is identical to the previous out-of-the-box
    default. % (computed via /) is unaffected.
  • Deleted Iterable<Deci>.averageDeci(). Iterable<Deci>.mean() (from org.kimplify.deci.statistics) is a
    drop-in replacement with the same signature and semantics.
  • Renamed config/DeciDivisionPolicy.ktconfig/DeciConfiguration.kt (its namesake type is gone).
    DeciConfiguration.logSink / disableLogging() are untouched.
  • Regenerated the ABI dumps (deci/api/jvm/deci.api, deci/api/deci.klib.api) and updated KDoc + README to the
    per-call divide(other, context) idiom.

Runtime behavior is unchanged for any code that never reassigned the global divisionPolicy.

Changelog

Changed

  • The / and % operators are now fixed to DeciContext.DEFAULT. Behaviour is unchanged for any code that
    never reassigned the (now-removed) global divisionPolicy: bare division still yields 20 fractional digits
    with HALF_UP rounding, and % (which is computed via /) is likewise unaffected.

Removed

  • Deprecated division-policy configuration removed (breaking). Deleted DeciConfiguration.divisionPolicy,
    DeciConfiguration.resetDivisionPolicy(), and the DeciDivisionPolicy class. The / operator no longer reads
    a global mutable policy; it always divides with DeciContext.DEFAULT (20 fractional digits, HALF_UP) —
    identical to the previous out-of-the-box default. To customise division scale or rounding, pass an explicit
    context per call: a.divide(b, DeciContext.CURRENCY_USD) or a.divide(b, scale = 4, roundingMode = RoundingMode.HALF_EVEN). DeciConfiguration.logSink / disableLogging() are unaffected.
  • Iterable<Deci>.averageDeci() removed (breaking). Use Iterable<Deci>.mean() from
    org.kimplify.deci.statistics instead — a drop-in replacement with the same signature and semantics:
    values.mean(context).

Test Plan

  • All tests pass (./gradlew allTests) — JVM, JS, WasmJs, iosSimulatorArm64, macosArm64 all green
  • Lint passes (./gradlew ktlintCheck)
  • API compatibility verified (./gradlew checkKotlinAbi) — ABI dumps regenerated; removed symbols absent
    from both JVM and klib dumps
  • Sample compiles against the new API (./gradlew :sample:composeApp:compileKotlinJvm)

kttipaydiogocavaiar and others added 2 commits June 9, 2026 10:05
… ABI validation (0.3.0)

Breaking changes:
- Remove DeciConfiguration.divisionPolicy, resetDivisionPolicy(), and the
  DeciDivisionPolicy class. The `/` and `%` operators now always divide using
  DeciContext.DEFAULT (20 fractional digits, HALF_UP) — identical to the
  previous out-of-the-box default. Use divide(other, context) or
  divide(other, scale, roundingMode) for explicit control.
- Remove Iterable<Deci>.averageDeci(); use Iterable<Deci>.mean() from
  org.kimplify.deci.statistics instead (drop-in replacement).

Build/tooling:
- Migrate from the deprecated standalone binary-compatibility-validator plugin
  to the Kotlin Gradle plugin's built-in abiValidation DSL. apiDump/apiCheck are
  replaced by updateKotlinAbi/checkKotlinAbi; the reference dump now lives at
  deci/api/jvm/deci.api (JVM) and deci/api/deci.klib.api (Native, JS, Wasm).
- Drop binary-compatibility-validator / bcv-gradle-plugin version-catalog
  entries and bump version to 0.3.0.

Rename DeciDivisionPolicy.kt to DeciConfiguration.kt and update CHANGELOG,
README, CLAUDE.md, and CI accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Merkost Merkost self-requested a review June 9, 2026 00:25
@diogocavaiar diogocavaiar merged commit b8648e1 into main Jun 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants