Comment #0 by qs.il.paperinik — 2024-07-09T12:13:50Z
Similar to Issue 24565 (out contract variable is implicitly const), function parameters should only be available as `const` and `scope` in contracts.
At least for `@safe` code.
Comment #1 by nick — 2024-07-09T16:01:57Z
The problem with requiring const for out parameters is that the return type might not convert to const if it has mutable indirections.
Comment #2 by qs.il.paperinik — 2024-07-09T18:17:24Z
(In reply to Nick Treleaven from comment #1)
> The problem with requiring const for out parameters is that the return type
> might not convert to const if it has mutable indirections.
Of course they convert to const. They might not be copyable to initialize a const variable, but it shouldn't be copied, so I don't see the problem. In particular, for parameters that already have a definite address and thus are trivial to reference.
Comment #3 by nick — 2024-07-09T18:34:58Z
> Of course they convert to const
Sorry, yes. The Issue 24565 problem was calling methods not annotated with const. So if this was implemented, it should be done in an edition to avoid breaking working correct code.
Comment #4 by robert.schadek — 2024-12-13T19:36:19Z