On Mon, Jun 7, 2021 at 10:53 AM Marc Nieper-Wißkirchen <
[email protected]> wrote:

>
> PS I would like to compare this again with the const qualifier of the C
> and C++ languages (with their respective semantics). There may be some
> programmers that are annoyed with compiler warnings when constness is not
> properly cast, but the majority isn't (I hope!) and instead makes sure that
> their programs are logically correct and make sure that every single cast
> makes sense. (And for the latter, it is important that the casts are
> explicit).
>
> (NB: Of course, the const qualifier in C is not without problems, often
> due to historical baggage, but this is a question of good API design and
> not its general usefulness.)
>

Actually, you can pass a non-const object to a function that expects a
const object without breaking the type semantics of C/C++.   I can argue
that the analogy holds for our case---a transient object can be passed to a
functional interface; since the transient object is "used", it will never
be passed to another linear-updating interface, hence it's safe.  Am I
missing something?

Reply via email to