Recent

Author Topic: AI and Free Pascal  (Read 6482 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3919
    • StrumPract is the musicians best friend
Re: AI and Free Pascal
« Reply #30 on: April 02, 2026, 07:43:53 pm »
Hi Fred, Your observations are entirely valid. Most of the recurring errors you see aren't due to the AI ​​being "bad," but rather to the lack of a stable working structure. When working with Pascal, Lazarus, or UOS, the model needs some guidance to behave consistently.

To avoid the typical repetition of syntax errors, logic errors, or inconsistent code, everything is greatly simplified by establishing two essential elements: clear instructions and a suitable context file.

Hello Sivestre.

Thanks for the tips, but I asked each AI: "What do I need to do to make sure you remember the corrections I show you and incorporate them in the next session?"

Their responses (similar for all the AIs): Add something like this to your main readme.md file:
Quote
Examples and Documentation

Before using UOS or asking questions, we strongly recommend looking at the examples in the examples folder. These examples demonstrate how to correctly use UOS features and can answer many practical questions.

Examples: (link to examples)

I did it but the same errors persist in the next session.

I also noticed that all the AIs make the same syntax errors; it's as if they were all following the same stupid teacher.
« Last Edit: April 02, 2026, 07:48:08 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

backprop

  • Full Member
  • ***
  • Posts: 216
Re: AI and Free Pascal
« Reply #31 on: April 02, 2026, 07:52:07 pm »

I did it but the same errors persist in the next session.

I also noticed that all the AIs make the same syntax errors; it's as if they were all following the same stupid teacher.

That is because every session starts with so far trained NN, i.e. model. It will never learn anything new from any  session permanently. Only if "official" personal do that.

Fred vS

  • Hero Member
  • *****
  • Posts: 3919
    • StrumPract is the musicians best friend
Re: AI and Free Pascal
« Reply #32 on: April 02, 2026, 07:57:59 pm »

I did it but the same errors persist in the next session.

I also noticed that all the AIs make the same syntax errors; it's as if they were all following the same stupid teacher.

That is because every session starts with so far trained NN, i.e. model. It will never learn anything new from any  session permanently. Only if "official" personal do that.

In any case, all these AIs should seriously review the Pascal language and not confuse it with C. Many of their Pascal syntaxes or declarations are actually C syntaxes/declarations.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

silvestre

  • Jr. Member
  • **
  • Posts: 84
Re: AI and Free Pascal
« Reply #33 on: April 02, 2026, 08:04:51 pm »
Hi Fred,

I went through the same phase you describe, when AI becomes more of a burden than a help, trying to please or even flatter you, rather than delivering useful code.

The basic problem with AI "hallucinations" is loss of context. If you notice, when a thread grows too large, they start summarizing. This summarization is a warning sign of lost context, which is why the .md file is so essential. It's a summary of the project that you should always keep in the project directory and update as the architecture grows.

Then there's something else that, without intending to advertise any particular company, makes all the difference: the models we use. Give Opus 4.6 a try, for example. The difference compared to previous AI models for software coding is enormous, although this may change in the future. The problem with using this model is the price of the tokens! There you'll find very few situations where the AI ​​says something childish to please you, like: "I'm giving you the corrected code, working perfectly and ready for production, even though it's full of bugs."

In the rules file, give it access to the Wiki with the object Pascal documentation for Delphi or Free Pascal so it can refer to it whenever it has problems or needs to know the RTL, models, etc.; it's essential.


Hi Fred, Your observations are entirely valid. Most of the recurring errors you see aren't due to the AI ​​being "bad," but rather to the lack of a stable working structure. When working with Pascal, Lazarus, or UOS, the model needs some guidance to behave consistently.

To avoid the typical repetition of syntax errors, logic errors, or inconsistent code, everything is greatly simplified by establishing two essential elements: clear instructions and a suitable context file.

Hello Sivestre.

Thanks for the tips, but I asked each AI: "What do I need to do to make sure you remember the corrections I show you and incorporate them in the next session?"

Their responses (similar for all the AIs): Add something like this to your main readme.md file:
Quote
Examples and Documentation

Before using UOS or asking questions, we strongly recommend looking at the examples in the examples folder. These examples demonstrate how to correctly use UOS features and can answer many practical questions.

Examples: (link to examples)

I did it but the same errors persist in the next session.

I also noticed that all the AIs make the same syntax errors; it's as if they were all following the same stupid teacher.

backprop

  • Full Member
  • ***
  • Posts: 216
Re: AI and Free Pascal
« Reply #34 on: April 02, 2026, 08:08:32 pm »
Funny thing is that Gemini can compile console code which it created with some online FPC compile and can output and read it and correct code. Thus you can demand to always show code and output. That saves a lot of headache, as it indeed tend to change any part of the code so far produced as it likes and be quiet about.

Fred vS

  • Hero Member
  • *****
  • Posts: 3919
    • StrumPract is the musicians best friend
Re: AI and Free Pascal
« Reply #35 on: April 02, 2026, 08:23:54 pm »
In the rules file, give it access to the Wiki with the object Pascal documentation for Delphi or Free Pascal so it can refer to it whenever it has problems or needs to know the RTL, models, etc.; it's essential.

I did it! The information is in the readme.md file on the UOS GitHub site, in bold as recommended by them.

But perhaps the AIs want to imitate humans and never read instructions or tutorials.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

440bx

  • Hero Member
  • *****
  • Posts: 6488
Re: AI and Free Pascal
« Reply #36 on: April 02, 2026, 08:24:26 pm »
In the rules file, give it access to the Wiki with the object Pascal documentation for Delphi or Free Pascal so it can refer to it whenever it has problems or needs to know the RTL, models, etc.; it's essential.
It sounds like A.I is just like any other tool, it is essential for its operator to know how to use it well in order to get the most out of it. 

I'm starting to think that those who have gained experience with various A.I models have valuable information to share about how to use A.I effectively. Maybe an A.I subsection in these forums would be beneficial.  Who knows, maybe an A.I company may be willing to sponsor FPC and/or Lazarus for a presence in the forums.
« Last Edit: April 02, 2026, 08:26:23 pm by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Fred vS

  • Hero Member
  • *****
  • Posts: 3919
    • StrumPract is the musicians best friend
Re: AI and Free Pascal
« Reply #37 on: April 02, 2026, 08:32:30 pm »
Funny thing is that Gemini can compile console code which it created with some online FPC compile and can output and read it and correct code.

 :o Really, wow that is great!

What do I need to ask it to do that?
« Last Edit: April 02, 2026, 08:38:10 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

backprop

  • Full Member
  • ***
  • Posts: 216
Re: AI and Free Pascal
« Reply #38 on: April 02, 2026, 08:51:53 pm »
:o Really, wow that is great!

Basically, something as this: "Create simple console program to sort 10 random integers for Free Pascal for Linux. Compile, run and send me full output."

The key is "Free Pascal for Linux", or "FPC for Linux". That force it to use some internal FPC. Ask it what it used! ;)

You can also send your code and several more units, I think. Did't tried that, but as I read, it can do that too.
« Last Edit: April 02, 2026, 08:55:09 pm by backprop »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12851
  • FPC developer.
Re: AI and Free Pascal
« Reply #39 on: April 02, 2026, 09:03:03 pm »
Moderator warning ignored, continueing offtopic posts -> topic locked.

 

TinyPortal © 2005-2018