rust-objc-foundation icon indicating copy to clipboard operation
rust-objc-foundation copied to clipboard

Make "into" methods take self with type Id<Self>

Open SSheldon opened this issue 10 years ago • 1 comments

Currently, functions like INSArray's into_vec cannot be methods because they must consume an Id<Self>. For example, into_vec is currently written as:

fn into_vec(array: Id<Self>) -> ...

This means it must be called as INSArray::into_vec(array). Ideally, it'd be nice to write this as:

fn into_vec(self: Id<Self>) -> ...

Then it'd be possible to just call array.into_vec().

In the May 6th meetings notes, it was mentioned this was apparently possible in a patch at the time: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2014-05-06.md#boxself, but this functionality doesn't appear to have shipped.

SSheldon avatar Mar 23 '15 15:03 SSheldon

There's an unstable feature for this now: rust-lang/rust#44874

SSheldon avatar Jan 19 '20 06:01 SSheldon