About `mut` or `var` syntax.

1\. For `T` is value type, `var x: T` or `x: var T`, here `x=y` or `x.p=y` 
means change the `value` of `x`, so variable `x` is same as the `value`.

2\. For `T` is ref type, `var x: T` or `x: var T`, here `x` is the pointer to 
the `value`, `x=y` means change the pointer, not the `value` of `x` pointer to.

> As parameter `x: var T` means two things:

>   1. We can change the pointer of `x`;
>   2. We can change the `value` the `x` pointer to.
> 

> 
> I think we can make the `var` keep the second meaning (change the value 
> rather than the pointer, so we needn't pass the pointer of pointer for `x: 
> var T` parameter) only, and it has the same meaning as the value type.

> Then we need new syntax(like `x: var mut T` or other, I think it is rarely 
> used) to support the first meaning(pointer of pointer parameter).

Reply via email to