Repository navigation
RFC(don't merge): Use proc macro instead of the UDL file - #14
Closed
Davidson-Souza wants to merge 7 commits into
Closed
Davidson-Souza wants to merge 7 commits into
Davidson-Souza wants to merge 7 commits into
Conversation
Remove the UDL definition for Amount and `ParseAmountError`, replace it with proc macros
This commit implements the last type with proc macros and removes the UDL file.
Collaborator
|
Thanks for the draft PR! I like the idea of using proc macros to avoid UDL duplication and more. I appreciate the one commit for one thing path you're taking now, makes it easier to review, and we can always just squash down at the end etc. Thoughts on some of the points you brought up:
Pumped to see the work you've done on this! |
Collaborator
|
This was great, merged in #29 so if you want to close this and take a look at what was merged and contribute its in |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in one of our last calls, this PR implements everything using uniffi's proc macros rather than a UDL file. It offers the advantage of requiring less code duplication and not requiring knowledge of the weird UDL syntax. Another advantage over using UDL is that you have better control over the scaffolding, so in unusual cases where uniffi can't implement things on its own, you can step in and do it.
I've implemented
Transactionand all it subfields, and migrated existing stuff to proc macros. Since this is an exploratory thing, I've used a mix ofRecordsandObjects. Records are cool in that they let consumers access the fields themselves, and without the indirections of anArc, but can't have associatedimplblocks.I've found some limitations along the way: looks like docstrings from the Rust code aren't used to document the bindings, only UDL docstrings. As per uniffi's docs:
There's also an odd problem with
dictionaries(orRecordin proc macros land). If I define one inbitcoin-ffiand make a dependent crate that uses that dict as a field for some other dict, the compiler errs, saying the original dict doesn't implementLowerandLift. But if I use in the same crate, it works just fine. I've followed their docs and issues, and couldn't find any reason why this didn't work (it does work with UDL definitions).Edit: Each commit implements one thing (or at least "only the nescessary to implement that thing"). However, if we decide to go this way, this PR obviously needs to be broken down.