Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Hooks DSL #29

Merged
merged 6 commits into from Jul 9, 2022
Merged

New Hooks DSL #29

merged 6 commits into from Jul 9, 2022

Conversation

stabbylambda
Copy link
Contributor

@stabbylambda stabbylambda commented Jun 28, 2022

What Changed

⚠️ Merge after #28

This PR introduces the empty Hook sealed class, which is the ultimate super type of all Hooks. The processor can look for this and use all the type information from the annotation instead of requiring the user to specify the type of hook twice, once in the annotation and once in the type signature. The downside to this is that the original type won't have any type information.

Why

Todo:

  • Add tests
  • Add docs
  • Add release notes

Release Notes

💥 Breaking Change 💥

Relax typing specification when using the DSL. Hooks should always use the Hook superclass as the specified type and rely solely on the annotation to specify the actual constraints of the hook:

abstract class CarHooks : Hooks() {
    @Sync<() -> Unit>
    abstract val brake: Hook
    
    @Sync<(newSpeed: Int) -> Unit>
    abstract val accelerate: Hook
}

📦 Published PR as canary version: 0.12.2-canary.29.311-SNAPSHOT

@stabbylambda stabbylambda marked this pull request as ready for review June 30, 2022 19:25
@sugarmanz sugarmanz added the minor Increment the minor version when merged label Jul 9, 2022
This enables the user to specify the type once, in the annotation,
without knowing about the correlation between the annotation classes and
the Hook types.
@sugarmanz sugarmanz merged commit 3c80969 into intuit:main Jul 9, 2022
@sugarmanz
Copy link
Collaborator

🚀 PR was released in v0.13.0 🚀

@sugarmanz sugarmanz added the released This issue/pull request has been released. label Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants