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

Improve message sending #38

Merged
merged 9 commits into from
Oct 3, 2021
Merged

Improve message sending #38

merged 9 commits into from
Oct 3, 2021

Commits on Oct 1, 2021

  1. Add public Message::send_super_message method for dynamic selectors

    Also cuts down on the hoops we have to jump through from msg_send to reach the actual message sending
    madsmtm committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    fabf442 View commit details
    Browse the repository at this point in the history
  2. Add helper trait MessageReceiver

    In Objective-C, having a null pointer receiver is valid, but with `msg_send!` it would be converted into a reference, which is undefined behavior. The reference was converted into a pointer immediately after, but it is still UB. There might also be a mutable reference somewhere else in the program, which would now be aliased.
    
    With this, we can now stop de-referencing the receiver of msg_send!, and still have Id work ergonomically. However, null pointer receivers are still discouraged because of all the other issues they cause!
    
    This change additionally allows sending messages to NonNull<T>, Option<&[mut] T> and Option<NonNull<T>>.
    madsmtm committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    663f32f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a94fd59 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e29349f View commit details
    Browse the repository at this point in the history
  5. Allow an optional comma after each argument to msg_send!

    This makes the syntax match Rust expectations a bit closer IMO
    madsmtm committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    605857a View commit details
    Browse the repository at this point in the history
  6. Manually format usage of msg_send!

    Rustfmt can't do this for us
    madsmtm committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    6d7ddbc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4cabdb9 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2021

  1. Remove ability to send messages to Option types

    We actually don't want to encourage sending messages to nil objects, since that is only supported for selectors that return pointers
    madsmtm committed Oct 3, 2021
    Configuration menu
    Copy the full SHA
    1b62354 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    18b26ba View commit details
    Browse the repository at this point in the history