Allow variable decleration with inout
and borrowed
keywords.
#2770
Replies: 1 comment
-
Closing as this seems to be discussed already in lifetimes-keyword-renaming |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently there is an asymmetry in the language, only function arguments can be declared as
owned
,inout
, andborrowed
but variable declarations are alwaysowned
(var
).I think completing the symmetry, allowing variable declaration as
inout
andborrowed
would be nice.declaring variable with
borrowed
andinout
:In for loop:
On a related note,
return type is also always
owned
and might benefit frominout
andborrowed
,but not sure about that, as it's very similar to Reference and maybe returning a mutable/immutable reference would allow the following functionality?
Beta Was this translation helpful? Give feedback.
All reactions