4 ms·
They actually allow you to opt out of ARC in Swift 6 by marking types as non-Copyable (~Copyable), along with “consume” and “borrowing” keywords. There are rest
by conradev 2y ago
They actually allow you to opt out of ARC in Swift 6 by marking types as non-Copyable (~Copyable), along with “consume” and “borrowing” keywords. There are restrictions (i.e. their use in generics is limited), but it’s pretty great for optimizing hot loops.
- jarjoura 2y agoHave you had much success adopting consume and borrow? Once you need anything in the swift standard library, you can't use a non-copyable struct with it. The keywords are all in too, so either you write completely self-contained rust-like code that doesn't touch your other code, or you revert back to using the older copyable types. I've tried many times to ease into using them, but I can never stick with them, and eventually revert. I do really like the high-level design though and look forward to it evolving into something usable.
- conradev 2y agoNope. The ergonomics are really bad at the moment. I also had to revert any places I used them in API surface. I haven’t had a use case yet where I could use them privately in the internal functioning of a type. I thought borrowing could still be used with Copyable types, though