Discussion:
Why my ; continuator idea is better for debugging too.
(too old to reply)
Skybuck Flying
2014-12-22 03:28:33 UTC
Permalink
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
able to detect this programming mistake.

Since it won't try to attach B to A since there is no continuator symbol.

I found it worth it to mention this so there ya go.

I am always glad when Delphi finds bugs like these... fortunately this time
I got lucky thanks to a type mismatch.

Also the statement would have looked like A:=B:=C; which I think is not a
valid statement in Delphi.

I ll test that just to be sure.

Yes fortunately Delphi does not allow such dangerous statements.

However I think C does, I am pretty sure of it. Another nice example why C
is dangerous ! ;)

(Also my request for python is the ":" symbol removed from language and
instead require statements to be on next line below if statement that be
nice)
(Currently the ":" is perceived by me as unnecessary and annoying, an easy
typo to make just like forgetting a ";" however these are not necessary in
python so why remove ";" but not ":" ? seems inconsistent, and ya know me...
I don't like inconsistencies, it's frikking annoying.).

Bye,
Skybuck.
Maynard A. Philbrook Jr.
2014-12-23 14:54:39 UTC
Permalink
In article <85795$54978fe1$5419aafe$***@news.ziggo.nl>, skybuck2000
@hotmail.com says...
Post by Skybuck Flying
Hello,
In the past I wrote about pascal's ; mistake.
; should be used as a continuator.
vBattlefieldLosingWarrior :=
// modified warrior and brain
vSimulatorWinningWarrior := vBattlefieldBattle.Warrior[0];
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,
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
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
Skybuck Flying
2014-12-23 21:52:33 UTC
Permalink
A:=B:=C:=D:=0;

With the continuator idea this coding would look as follows:

Good single line code:

A:=B:=C:=D:=0

Bad multi line code:

A:=
B:=
C:=
D:=
0

^This would not be allowed and lead to error messages.

Good multi line code:

A:=;
B:=;
C:=;
D:=;
0

^ This would lead to a good compile.

Bye,
Skybuck :)

Loading...