|
|
|
|
|
by leshow
3193 days ago
|
|
> (Swift operators are just normal functions with special call syntax.) Coming from Haskell and Rust it's nice to see this trend catching on. Is Swift planning to introduce a distinction between borrows and mutable borrows to the user? From what you describe it seems like right now syntax-wise a borrow and a mutable borrow look the same, and the runtime makes some decision about it. edit: Or I guess it could be the opposite. Since Swift passes by value always unless the runtime can optimize (right?), you could just not write & and inout and cross your fingers it gets optimized to a borrow rather than a copy? Stuff like this makes me prefer the explicitness of Rust. It seems like here on the surface it's abstracted from you, but really you need to know the rules anyway or you could get into trouble. |
|
It was already like that in older languages like Lisp, Smalltalk and CLU, just C++ made them in a different way.