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

Safety of methods appear to be illogical #685

Open
kvark opened this issue Dec 21, 2024 · 3 comments
Open

Safety of methods appear to be illogical #685

kvark opened this issue Dec 21, 2024 · 3 comments
Labels
A-framework Affects the framework crates and the translator for them help wanted Extra attention is needed

Comments

@kvark
Copy link

kvark commented Dec 21, 2024

Looking at MTLInstanceAccelerationStructureDescriptor, I see setInstanceCount being safe but setInstanceDescriptorType being unsafe. That doesn't make sense.

@madsmtm madsmtm added help wanted Extra attention is needed A-framework Affects the framework crates and the translator for them labels Dec 22, 2024
@madsmtm madsmtm added this to the Polish frameworks milestone Dec 22, 2024
@madsmtm
Copy link
Owner

madsmtm commented Dec 22, 2024

Yeah, the simple reason is that setInstanceCount is explicitly marked as safe, while setInstanceDescriptorType just... Isn't (yet, PRs adding it welcome).

The issue is fundamental, it's unsound for us to mark something as safe without a human in the loop (this is FFI to a C-like language, and C can do anything, regardless of the signature of the function).

That said, Objective-C is more constrained, and usually doesn't do crazy things, so I do have a few thoughts and ideas for automatically marking certain things as safe in certain cases - just haven't gone down that route yet, my priorities have been on making the bindings correct before making them convenient ;)

@kvark
Copy link
Author

kvark commented Dec 23, 2024

Got it, yeah. It's unfortunate if we have to go and inspect every method for safety. Compromises the idea of auto-generated bindings to start with.
Please feel free to close if this is already tracked.

@madsmtm
Copy link
Owner

madsmtm commented Dec 23, 2024

I thought I'd written it down somewhere, but no, the ideas for doing some of it automatically have only existed in my head... So I'll keep this issue open, and track it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants