Skip to content

Require a box receiver for ssl/crypto's apply methods - #99

Merged
SeanTAllen merged 1 commit into
mainfrom
plain-fun-on-crypto-primitives
Jul 10, 2026
Merged

Require a box receiver for ssl/crypto's apply methods#99
SeanTAllen merged 1 commit into
mainfrom
plain-fun-on-crypto-primitives

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

Every apply on ssl/crypto's hash and one-shot primitives, and the HashFn interface, was declared fun tag. On a fieldless primitive tag and box compile to the same code, but tag forced a HashFn implementer to declare apply tag as well, because a box method is not a subtype of a tag one. Dropping tag widens what satisfies the interface and only breaks calling through a HashFn tag reference.

The interface has to lose tag before its implementers can, so all thirteen declarations change together.

Closes #94

@SeanTAllen SeanTAllen added the changelog - changed Automatically add "Changed" CHANGELOG entry on merge label Jul 10, 2026
@SeanTAllen

Copy link
Copy Markdown
Member Author

Autonomous-mode decision log — PR-specific

No design decision here; the breaking change follows the issue's fix direction
directly. One correction the pre-PR review caught in my own work: the release
note first opened with "Every apply in ssl/crypto was declared fun tag,"
which is false — ConstantTimeCompare.apply and _EVPContext.apply were already
plain fun. Reworded before opening.

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Jul 10, 2026
`fun tag` on a primitive weakens the receiver to one that cannot read
fields, on a type that has none. It bought nothing and cost the `HashFn`
interface its implementers: a `box` method is not a subtype of a `tag`
method, so every implementer had to declare `apply` `tag` as well.

The interface has to lose `tag` before its implementers can, so all
thirteen declarations change together.

Closes #94
@SeanTAllen
SeanTAllen force-pushed the plain-fun-on-crypto-primitives branch from f503393 to 4e4df67 Compare July 10, 2026 17:18
@SeanTAllen
SeanTAllen merged commit 25ce56a into main Jul 10, 2026
12 checks passed
@SeanTAllen
SeanTAllen deleted the plain-fun-on-crypto-primitives branch July 10, 2026 17:21
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Jul 10, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 10, 2026
github-actions Bot pushed a commit that referenced this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - changed Automatically add "Changed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crypto primitives declare apply as fun tag instead of plain fun

2 participants