Skip to content

refactor: align theta view and coupon naming - #165

Merged
tisonkun merged 3 commits into
mainfrom
codex/theta-view-coupon-naming
Jul 27, 2026
Merged

refactor: align theta view and coupon naming#165
tisonkun merged 3 commits into
mainfrom
codex/theta-view-coupon-naming

Conversation

@tisonkun

@tisonkun tisonkun commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

This PR applies the two approved naming changes from the follow-up audit:

  • rename RawThetaSketchView::theta() to theta64()
  • rename Coupon::from_hash() directly to from_value() (option 8B)

The cached seed_hash fields remain unchanged following the final decision on item 6. The raw-view visibility strategy (item 1) and changelog work (item 5) remain deferred.

Commit-by-commit rationale

  1. 2aabb8aAlign the raw Theta threshold name. Renames RawThetaSketchView::theta() to theta64() and updates every implementation and set-operation call site. The suffix makes the raw 64-bit threshold representation explicit and avoids conflating it with higher-level theta terminology. This is a naming-only change; threshold values and algorithms are unchanged.
  2. 5baab5eName the Coupon constructor after its input. Renames Coupon::from_hash(value) to Coupon::from_value(value) across the public API, documentation, examples, internal callers, and tests. The method hashes its generic input internally, so from_hash incorrectly implied that callers supplied an already-computed hash. Per option 8B, this is a direct rename without a deprecated compatibility alias.

Compatibility notes

Both commits rename public methods. The changelog entry is intentionally deferred until the release review requested in item 5.

Validation

  • cargo x test
  • cargo x lint
  • git diff --check origin/main...HEAD

@tisonkun
tisonkun marked this pull request as ready for review July 25, 2026 15:36
/// becomes the 6-bit register value.
#[inline(always)]
pub fn from_hash<T: Hash>(v: T) -> Self {
pub fn from_value<T: Hash>(value: T) -> Self {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renames Coupon::from_hash(value) to Coupon::from_value(value). The method hashes its generic input internally, so from_hash incorrectly implied that callers supplied an already-computed hash.

cc @notfilippo is this rename reasonable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much clearer. Thanks!

@tisonkun
tisonkun requested review from ZENOTME and notfilippo July 25, 2026 15:43

@ariesdevil ariesdevil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantics are clearer.

@tisonkun
tisonkun requested a review from PsiACE July 27, 2026 08:50
@tisonkun
tisonkun merged commit 0b8ec82 into main Jul 27, 2026
10 checks passed
@tisonkun
tisonkun deleted the codex/theta-view-coupon-naming branch July 27, 2026 12:06
@tisonkun

Copy link
Copy Markdown
Member Author

Merging ...

@notfilippo your feedback is always welcome since we're still a bit away from a 0.4 release.

@notfilippo notfilippo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks!

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.

4 participants