-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Model driven api #885
Model driven api #885
Conversation
be2dc31
to
67a2337
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @Michael-F-Bryan, this is great! Looking forward to merging this!
I didn't go through this pull request line-by-line. This is a lot of code, and I figure it's more efficient to immerse myself in it over the next weeks and months of working with it, instead of trying to understand every detail right now. The CI build passes, so I'm confident it's working as intended, or close enough.
I did look at every commit though, and do have some comments:
- I think it's a bit unfortunate that within the
fj
crate, the code for defining models (everything that was there before this PR) is intermixed with the new code. I think it would be better to have the new code in a dedicated module, which is clearly documented as "don't worry about this, this is taken care of for you (by the proc macro)". - If that were the case, then the
abi
module could be un-#[doc(hidden)]
. I've worked with crates in the past that are hiding internal implementation details from the API reference, and I found this is often confusing, and just makes it more likely that I have to dive into the code. - What's up with those
todo!
s that are still left in the code? Where those missed, or is that stuff that can be filled in later? (I mean, CI passes, so presumably the latter.) - All that hand-written FFI code is unfortunate, but given that we'll most likely switch to WebAssembly and WIT in the future, it's fine. If that code turns into too much of a maintenance issue, we can accelerate the transition to WASM/WIT, by publishing our own fork of
wit-bindgen
to crates.io, as I suggested as a possibility in Switch to model-driven model system #804.
All of those comments are just my observations on where I see potential for improvement, or where I could see things go. None of them need to be taken care of in this pull request, and in fact I'd prefer if we could get this pull request merged quickly and take care of anything else later.
However, there is one thing that I see as a blocker: With this change, we're losing the convenient #[fj::model]
syntax, and I'd rather keep that. That syntax is mentioned in the README and past release announcement, and we'd have to at least adapt the README to prevent false advertising.
I think it would be better to port the macro to the new infrastructure instead before merging this PR. What do you think?
749cdc7
to
dd356cc
Compare
@hannobraun can you have another look at this? I've updated the
Agreed. The main barrier to splitting them is that we have a dependency cycle.
Oops! I forgot to wire up converting the FFI-safe version of
Yeah, it's not great. In theory, we could use Sorry for the delay, I spent most of last week out of the city and away from a computer. |
Thank you, @Michael-F-Bryan! I'll take another look later today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, @Michael-F-Bryan! Looks good!
I'm going to merge this PR now, and will address your comments in a separate comment.
But I was suggesting to collect the new code in a module within the
I actually experimented with In any case, the code exists now. If it turns into a problem before the WASM/WIT migration, we have options.
No problem! Thank you for taking the time to update this PR and get it merge-ready! |
This is an initial implementation of #804 based on the ideas I was trying in Michael-F-Bryan/fornjot-plugins. The discussion in #804 (comment) contains a more in-depth explanation of how it works.