Why my ; continuator idea is better for debugging too.
Maynard A. Philbrook Jr.
jamie_ka1lpa at charter.net
Tue Dec 23 09:54:39 EST 2014
In article <85795$54978fe1$5419aafe$2552 at news.ziggo.nl>, skybuck2000
@hotmail.com says...
>
> Hello,
>
> In the past I wrote about pascal's ; mistake.
>
> ; should be used as a continuator.
>
> I just made a programming mistake which solidifies/merits my idea:
>
> The programming mistake was this:
>
> vBattlefieldLosingWarrior :=
>
> // modified warrior and brain
> vSimulatorWinningWarrior := vBattlefieldBattle.Warrior[0];
>
> Code should look like this:
>
> vBattlefieldLosingWarrior :=
> TBattlefieldWarrior(vBattlefieldBattle.Warrior[2].Association);
>
> // modified warrior and brain
> vSimulatorWinningWarrior := vBattlefieldBattle.Warrior[0];
>
> Fortunately there was a type mistmatch which hinted me at the programming
> mistake.
>
> The code is a bit messy above so let's make a simpler example to understand,
> the in my oppinion, dangerous programming mistake:
>
> A :=
>
> B := C;
>
> The above statements "A :=" is valid in Delphi's current design.
>
> The danger is that B is assigned to A which is not what I wanted, the
> problem was missing code at A.
>
> So the danger is that some day, somebody will write B in such a way that it
> will accidently be assigned to A.
>
> By using ";" as a continuator instead of a "seperator" the code would look
> as follows:
>
> A :=
>
> B := C
>
> Since there was no continuator specified, "future-Delphi" would have been
That is perfectly valid and a good idea too.
You can have a string of variables you need to initiate to short cut
the coding, plus I also think it compacts the generated code because you
only need to load a single register with the initial value.
A:=B:=C:=D:=0;
All get set the zero..
Jamie
More information about the Python-list
mailing list