Skip to content

Idea: Make Encode sufficient for safety #118

@madsmtm

Description

@madsmtm

Currently, when accessing instance variables or calling methods the user must verify that the types actually match what Objective-C expects; this is cumbersome, although it can be somewhat alleviated using the "verify_message" feature.

But what if we were to enable "verify_message" always (or at least with debug_assertions)? Could we change Encode somehow to allow msg_send! to become much safer? Or maybe it would be possible to add a safe variant (msg_send! vs. msg_send_unchecked!) that allows a subset of functionality?

An example: Disallow Encode on types like NonNull<T> and &T because their validity cannot be verified using Objective-C encodings (because Rust has a more expressive type-system than C). Or at least disallow them on the return type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions