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.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to