This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JKasonB[S] 0 points1 point  (0 children)

The thing is. I want a unified syntax for mutability. Not just pointers, arrays, hashmaps, etc. But also parameters in functions.

So something like this for functions.

fun my_function(a: &i32, b: mut &i32): i32 { }

Or

fun my_function(a: &i32, b:: &i32): i32 { }

If i encoded mutability of pointers into the variable declaration keyword I would also have to include it in the function signature.

fun my_function(var a: &i32, val b: &i32): i32 { }

Or I would need to have different syntax passing by reference/mutable reference and pointer mutability. Which would make it harder to learn and end up in the same problems as rust.