Creating a programming error still is simple, and AI isn’t helping me yet.
I develop software for Microsoft Business Central, in a programming language called C/AL (and in de current version this is changed to AL).
Today in a hurry, bugfixing job, I introduced a new error. The code was more than one page long, and I used a for loop with a local variable _i.
And then I nested two for loops…
for _i := 0 to n do begin // ... a bunch of code for the rest of the page for _i := 0 to m do begin //create a record and insert into the database // and m begin typically begin 1 or 2 and // n going to 40 or so. end end.
The actual code between the 2 loops was more than one page on the monitor. And so I created an infinite loop, for the first time in years.
In C/AL this was inside a transaction, so the table got locked, users complained, and I was able to kill the process. But it had to rollback the transaction. And it already contained +3.5 million records before the message reached us.
And although this is legit coding (or how should the compiler know?), reusing _i in a second inner loop.
With all AI stuff currently available, I hope for a compiler warning at least.