Skip to content

Safety of methods appear to be illogical #685

Open
@kvark

Description

@kvark

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

Activity

added
help wantedExtra attention is needed
A-frameworkAffects the framework crates and the translator for them
on Dec 22, 2024
added this to the Polish frameworks milestone on Dec 22, 2024
madsmtm

madsmtm commented on Dec 22, 2024

@madsmtm
Owner

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

kvark commented on Dec 23, 2024

@kvark
Author

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

madsmtm commented on Dec 23, 2024

@madsmtm
Owner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frameworkAffects the framework crates and the translator for themhelp wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kvark@madsmtm

        Issue actions

          Safety of methods appear to be illogical · Issue #685 · madsmtm/objc2