[M3devel] [M3commit] CVS Update: cm3
hendrik at topoi.pooq.com
hendrik at topoi.pooq.com
Tue Jul 6 18:53:56 CEST 2010
On Tue, Jul 06, 2010 at 10:05:43AM +0000, Jay K wrote:
>
> > used it should be a giant red flag to the reader that the variable x is
> > going to be initialized with a value that the programmer doesn't know
> > at the time of declaration. What on earth do you gain from x := 0?
> > A "little correctness"?
>
> You are making the code more expensive to maintain, by making
> it harder for a human to analyze. For the benefit of microoptimization.
Microoptimisation as a purpose? Didn't he just explain that
VAR x : INTEGER;
is intended to signal to the *reader* that the initial value is
irrelevant? The fact that a naive compiler might compile it slightly
more efficiently is a side effect, not a purpose. If he were interested
in microoptimisation, he would better feed it into a flow-analysing
compiler, which could even detect when an explicit initialization like
VAR x := 0;
is irrelevant and suppress it.
It's not *about* optimisation.
Indeed, they syntactic awkwardness of declaring variables with WITH
(to make sure they're initialized where they're declared) is one of
the problems of Modula 3, and one of the few places where C did it
better. Granted C, didn't do this at all initially, and took it from
Algol 68 in one of C's rounds of standardisation.
-- hendrik
More information about the M3devel
mailing list