Skip to content

SE proposal for borrow/inout reference declarations#1915

Open
tbkka wants to merge 3 commits intoswiftlang:mainfrom
tbkka:tbkka-reference-declarations
Open

SE proposal for borrow/inout reference declarations#1915
tbkka wants to merge 3 commits intoswiftlang:mainfrom
tbkka:tbkka-reference-declarations

Conversation

@tbkka
Copy link
Contributor

@tbkka tbkka commented Jan 18, 2023

This SE proposal describes a way to add "reference declarations" to the Swift language that would give more fine-grained control over copy and retain/release behavior as well as provide rich functionality for use with noncopyable objects.

* Ongoing work on C++ interoperability and Swift noncopyable
types will soon allow Swift programs to work with values that
do not support copying at all.
Such values cannot easily be used with the existing `let` and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line makes it sound like noncopyable types cannot be used with let/var. I wonder if it is possible to loosen the terminology to say that there are usability holes or maybe that there are code patterns we would like to support that one cannot do easily if one just has access to let/var? In my head the issue is not that let/var constructs cannot easily be used with noncopyable types... they can be! It is just the semantics of the type create major restrictions on how one can use let/var and thus make it impossible to express normal code patterns that one would use a let/var to express today? Just some food for thought.

@rjmccall
Copy link
Contributor

@tbkka From your perspective as author, is this ready to run, or should it still be a draft?

@tbkka
Copy link
Contributor Author

tbkka commented Jan 23, 2023

@rjmccall The implementation is still very much WIP, but I'm pretty happy with the proposal itself. I would be very pleased to run this and get more detailed feedback, including feedback from the LWG.

@rjmccall rjmccall added the LSG Contains topics under the domain of the Language Steering Group label Apr 1, 2024
@rjmccall rjmccall added the workgroup: needs implementation This proposal needs more implementation work before it can be reviewed label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LSG Contains topics under the domain of the Language Steering Group workgroup: needs implementation This proposal needs more implementation work before it can be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants