Date: Wed, 2 Mar 2022 13:38:06 +0200
On Wed, 2 Mar 2022 at 13:33, Maciej Cencora <m.cencora_at_[hidden]> wrote:
>
> Lol. I am not a proponent of Rust, I have never written a single line
> of code in that language, nor did I read any book about it.
Right, I was just curious if perhaps rust-like semantics were what you
were aiming for.
> If you think I am wrong, then please show me how this mentioned issue
> can be solved without a language level construct?
Convention. Don't declare functions to take rvalue references if they
don't move, or otherwise document
such functions if they move only sometimes. That's what we do today,
and I don't have much evidence
of that being insurmountable.
> Also there is a problem of teachability, which I'm sure you are aware
> of if you teached anyone about move-semantics:
> - std::move does nothing,
It does what it claims to do, it enables moving.
> - STD provides some guarantees about moved-from variables,
> - better not to use moved-from variable except maybe for assigning it
> a new value,
> - std::move(x) will compile even if x is const.
> - ...
> It is just not a simple topic, and a language level move/relocate
> would eliminate most of the complexity.
..while introducing fair amounts of different complexity.
>
> Lol. I am not a proponent of Rust, I have never written a single line
> of code in that language, nor did I read any book about it.
Right, I was just curious if perhaps rust-like semantics were what you
were aiming for.
> If you think I am wrong, then please show me how this mentioned issue
> can be solved without a language level construct?
Convention. Don't declare functions to take rvalue references if they
don't move, or otherwise document
such functions if they move only sometimes. That's what we do today,
and I don't have much evidence
of that being insurmountable.
> Also there is a problem of teachability, which I'm sure you are aware
> of if you teached anyone about move-semantics:
> - std::move does nothing,
It does what it claims to do, it enables moving.
> - STD provides some guarantees about moved-from variables,
> - better not to use moved-from variable except maybe for assigning it
> a new value,
> - std::move(x) will compile even if x is const.
> - ...
> It is just not a simple topic, and a language level move/relocate
> would eliminate most of the complexity.
..while introducing fair amounts of different complexity.
Received on 2022-03-02 11:38:18