my understanding of the new ownership specifiers (consuming, borrowing) is they were intended to obsolete the old ARC hints like __shared. but i am having a lot of trouble migrating inits that take __shared parameters; borrowing introduces a lot of restrictions that __shared does not have.
does __shared still have a place in new 5.9+ code?
3 Likes
Joe_Groff
(Joe Groff)
2
__shared maintains the behavior it had already to provide source compatibility, so compared to borrowing, it doesn't introduce the no-implicit-copy restriction on the parameter binding, and it also has some ABI differences. It would be better IMO to prefer borrowing for new code. You can use the copy x operator with a borrowing parameter to allow explicit copies where necessary.
10 Likes
ah, that’s what i needed!
aside: we truly have terrible pagerank…
4 Likes
Joe_Groff
(Joe Groff)
4
We should probably also offer copy x as a fixit when diagnosing borrow issues with borrowing/consuming parameters too.
5 Likes