On Tuesday, 26 May 2015 at 12:54:27 UTC, Timon Gehr wrote:
On 05/26/2015 06:35 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?=
<ola.fosheim.grostad+dl...@gmail.com>" wrote:
One of C's design mistakes is to make assignments expressions
and not
statements.
I think it is more about returning void vs. returning the
lvalue. The expression/statement distinction is unnecessary.
Not sure what you mean, the ideal for writing maintainable code
is that expressions are either free of side effects or that side
effects at least are independent and encapsulated in a robust
manner.
Everything is unnecessary beyond the bare minimum (e.g. a Turing
Machine), but for a sensible imperative language the distinction
between statements and expressions is necessary, due to control
flow, which is why SSA needs the phi function:
http://en.wikipedia.org/wiki/Dominator_(graph_theory) . Unless
you are doing something completely different, like some weird
non-deterministic language.
That said, another C design-flaw is that you cannot prevent
return values from being ignored, but I think that is another
issue more related to resource management and ownership.
In terms of describing intent, the distinction between functions,
procedures and constructors have a lot of value. And actually,
also visually distinguishing between ownership transfer,
referencing of objects and value assignment…