Skip to content

Conversation

@tcharding
Copy link
Member

This is an alternative to #604 based on review suggestion.

Draft for feedback please.

In Rust, by convention, traits with a single method are named the same
as the method. `Liftable` should be called `Lift`, make it so.
Observe:

- The semantic/abstract policy is a rust-miniscript thing but the policy
  language (`concrete::Policy`) is a general miniscript thing.
- The `semantic::Policy` can be created by lifting more than just a
  concrete policy (eg, a descriptor).

Do the following:

- Move `src/policy/semantic.rs` to `src/lift/lifted.rs` (leaving the
  type as `Policy`).
- Move the contents of `src/policy/mod.rs` (excl. tests/benches) to
  `src/lift/mod.rs`.
- Add a re-export `lift::lifted::Policy as Lifted` and use it in other
  parts of the code base.

Note, the idea to keep the `lifted::Policy` as is and re-export helps
keep this patch smaller but also gives some choice to how the type is
used

- `use crate::lift::Liftded` coupled with usage of `Lifted`.
- `use crate::lift::lifted` coupled with usage of `lifted::Policy`

We can the do a rename later if deemed appropriate.
@apoelstra
Copy link
Member

I like this. @sanket1729 what do you think?

@tcharding
Copy link
Member Author

Do we want to do this?

@apoelstra
Copy link
Member

The TL;DR of this PR is:

  • Rename policy::Liftable trait to lift::Lift
  • Rename policy::Semantic type to lift::Lifted
  • Rename policy::Concrete type to policy::Policy

In short, yes, I want to do this, but we should think about whether we can make the transition easier somehow. (The type renames we can definitely do with deprecations and/or type aliases and backports; the trait I'm less sure about.)

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.

2 participants