copy at call sites could be useful too. You could be saying "hey, no matter what the function signature says, take a copy of this value. I don't want you to change it and/or I don't want to accidentally change it out from under you".
-- https://github.com/hsutter/cppfront/pull/198#issue-1520183742 (extract)
Old quotes:
> > `inout` in-particular seems like important information I'd like to see at call sites.
> > -- (extract)
>
> For `inout` (or `mut`) we probably want to know that we're calling an `inout`- or possibly `move`-declared parameter. But we don't know those things unless we implement more name lookup and possibly overload resolution (neither of which cppfront has to do now) which is a big job I want to defer until later.
> -- (extract)
**[M](#last-use)ove from last use**:
Starting with #231 (68 comments).
> > When cppfront moves `x` on its last use it breaks the requirements of the `f2` function that requires an lvalue reference but gets an rvalue reference.
> > -- (extract)
>
> One way to suppress this could be to require a mutating argument to be qualified with `inout`, which I've thought of and @jbatez suggested in #198.
> -- (extract)
Then follows a very long discussion starting with .
It proposes to look into a way to opt-out of a function call's results,
consistent across the return value and `inout`/`out` arguments.
Duplicates:
- #288
- #396
Also asked at:
-
Title: Consolidated feedback on enabling more argument qualifiers.
Introduction:
Currently valid:
f(move x)
f(forward x)
f(out x)
Currently invalid:
f(in x)
See https://github.com/hsutter/cppfront/wiki/Design-note:-Explicit-discard.f(inout x)
f(copy x)
Other contexts where those keywords can be valid: https://github.com/hsutter/cppfront/issues/456#issuecomment-1547913413.
in
:copy
:I also think
copy
should subsume C++23'sauto{x}
.408's PR allows
copy x
outside an argument list, permitting this generalization.inout
:The need for this is resolved, see https://github.com/hsutter/cppfront/issues/305#issuecomment-1586580100.
Old quotes:
> > `inout` in-particular seems like important information I'd like to see at call sites. > > --See also:
456
452
425
421
413
408
397
343
317
250
231
198