-
Notifications
You must be signed in to change notification settings - Fork 233
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
UniFFI Extensions #1920
Comments
Some ideas for extensions:
|
Thanks for raising this! Should we define a concrete goal for UniFFI extensions? ie, some way of declaring success, or some yardstick to hold up against ideas? One possibility is something like "avoid the need to have hand-written wrappers around uniffi components". Mocks and async adaptors probably fall into this category. Mozilla's places wrappers seems like a rich vein of ideas too (there we split things based on read-only or read-write capabilities, record telemetry, transform some values, and other things best described as "make a rusty api look more kotliny"). It would be interesting to hear what other uniffi consumers do here (ie, is it a universal experience that wrappers are needed, or have Mozilla just created an overly complex system due to other constraints we have around how we actually ship our components?) (Another reason I like the "avoid hand-written wrappers" thing is due to the newish docstring capability - having hand-written wrappers be what's ultimately consumed means none of our docstrings are going to be visible to our Android devs. hand-written wrappers also just smells like uniffi limitations rather than conscious decisions) Maybe that's not quite the correct lens to view this through, but I think a concrete problem statement would help us know if we are heading in the right direction? |
Great question. I think "avoid the need to have hand-written wrappers around uniffi components" is a great first draft at a goal. Maybe there are some hand-written wrappers that should be non-goals, for example ones that don't depend on the metadata and the extension would just be copy and pasting the code. I think we can identify those that out as we go. I also really like the places example. Maybe even better than a goal statement, would be a list of use-cases that we want to address
I totally agree. |
A while back when we were discussing decorators, one of the suggestions was to add support for "UniFFI extensions", which could generate additional code. Back then it was very hand-wavey, but maybe it's time to revisit this. I think a couple changes make it possible to discuss concretely:
uniffi_meta
structs, which are JSON serializable.Could this work?
--extension=[path-to-executable]
flag. Multiple extensions could be specified.uniffi_meta::Metadata
values. Maybe we could move towards stabilizing this -- meaning we would promise to only add new variants/structs.FFIConverter
namesThe text was updated successfully, but these errors were encountered: