Following the discussion from:
https://forum.dlang.org/post/kyonizwffgvpuvrwhoog@forum.dlang.org
On Wednesday, 19 October 2022 at 01:49:26 UTC, mw wrote:
>On Wednesday, 19 October 2022 at 01:38:27 UTC, Adam D Ruppe wrote:
>On Wednesday, 19 October 2022 at 01:34:54 UTC, mw wrote:
>Is there any (design) doc about this?
scroll up, click the link from this very thread.
"""
Rather than make either sacrifice, this DIP proposes a design that allows both rigor and simplicity to be maintained, and reserves the possibility for a future DIP to allow @mustUse as a function attribute.
"""
Another future DIP? I think this DIP is flawed for not using "@mustUse as a function attribute"
@mustuse as a function attribute was in the original version of the DIP. It was vetoed by Walter. Thus, only the type attribute remains in the accepted version.
FWIW, this is the same path that #[must_use] took in Rust. It was added originally as a type attribute only, and later had its usage extended to functions.
In case anyone does not know, I'd like to refer to the following: command query separation principle
"""
It states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both.
"""
For a query, its return value should never be disregarded, this is forced by the Eiffel compiler.
The kind of problem (wasting hours of development time, frustration and pain) the OP's author has experienced would have never happened if s/he is using Eiffel.
@Walter, you haven't study Eiffel well enough? although you said you have Meyer's book?