Recent

Author Topic: Winter is coming (AI-assisted coding and its influence on Free Pascal)  (Read 15925 times)

Dzandaa

  • Sr. Member
  • ****
  • Posts: 428
  • From C# to Lazarus
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #15 on: December 15, 2023, 07:30:32 pm »
Hello
Ever since I was a kid I've always been fascinated by AI, first in science fiction books and movies.

So I became a programmer, then a programming analyst.

Now I am retired and I can finally day with AIs.

But I'm still wondering...

Won't the human race regress in the future, training its brain less?

And where will the pleasure of creating a program still be?

Think of it...  :D

https://time.com/5311672/iq-scores-decline-environment/
« Last Edit: December 15, 2023, 07:42:36 pm by Dzandaa »
Regards,
Dzandaa

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #16 on: December 15, 2023, 07:59:05 pm »
https://time.com/5311672/iq-scores-decline-environment/

One of the enviromental factors may be the so called "Dark design" of social media. Tik Tok, Facebook, Instagram, etc, all of them are fighting for your attention using, in some cases, unethical strategies. For example, applying AI-algorithms to predict your preferences and turn you in a "happy slave" doing infinite scrolling.
« Last Edit: December 15, 2023, 08:03:44 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #17 on: December 15, 2023, 08:02:14 pm »
If you are really dumb, AI-assisted tools may not help you to getting smarter. However, If you are smart, you can make excellent use of a tool. And notice, it is just a tool.   
Be mindful and excellent with each other.
https://github.com/cpicanco/

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1422
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #18 on: December 16, 2023, 12:17:01 am »
Quote
Won't the human race regress in the future, training its brain less?

And where will the pleasure of creating a program still be?

Think of it...  :D

It is already the case. People don’t want to waste their time and energy engaging in deep thought or being creative , they just take shortcuts based upon emotions and misinformation.

I don’t want AI ! , I want live people who are interested in pascal to have real time conversations with about pascal! Is this too much to ask for? Without good conversations i feel like I’m the last person on earth still doing pascal It just gets lonely and tedious, not fun at all. Impossible to stay motivated..

People always talk about ai as if it’s some sort of magical panacea. I would like to know more about exactly who is behind all this ai stuff and what they have accomplished with previous projects.
 I can say that I’m not too happy with the direction in which things are going. It’s easy to get seduced and then become dependent upon by some new technology that promises infinite knowledge at your fingertips. At first it is great being able to search the internet and find all sorts of stuff but then things change. The searches stop giving unbiased info and are replaced by propaganda and manipulation. But people are lazy and complacent and don’t notice what is happening and insist that they are getting good information when they aren’t.

But it gets worse than that, people are actively discouraged from gathering and having discussions with other people unless someone is profiting off it. Public places are now populated by fleshbots staring at phones who not only have no interest in the people around them but often physical hazards that are a threat to their very  existence.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #19 on: December 16, 2023, 01:29:42 am »
Quote
Won't the human race regress in the future, training its brain less?

And where will the pleasure of creating a program still be?

Think of it...  :D

It is already the case. People don’t want to waste their time and energy engaging in deep thought or being creative , they just take shortcuts based upon emotions and misinformation.

I don’t want AI ! , I want live people who are interested in pascal to have real time conversations with about pascal! Is this too much to ask for? Without good conversations i feel like I’m the last person on earth still doing pascal It just gets lonely and tedious, not fun at all. Impossible to stay motivated..

People always talk about ai as if it’s some sort of magical panacea. I would like to know more about exactly who is behind all this ai stuff and what they have accomplished with previous projects.
 I can say that I’m not too happy with the direction in which things are going. It’s easy to get seduced and then become dependent upon by some new technology that promises infinite knowledge at your fingertips. At first it is great being able to search the internet and find all sorts of stuff but then things change. The searches stop giving unbiased info and are replaced by propaganda and manipulation. But people are lazy and complacent and don’t notice what is happening and insist that they are getting good information when they aren’t.

But it gets worse than that, people are actively discouraged from gathering and having discussions with other people unless someone is profiting off it. Public places are now populated by fleshbots staring at phones who not only have no interest in the people around them but often physical hazards that are a threat to their very  existence.

As someone that have some background in psychology, I completely agree when you say that we need more face-to-face interactions and humanized relationships. However, AI is a powerful tool and may be used for good or for bad. You may use it to turn people into zombies, or to help them solving their problems, as a community. You may use physics to create nuclear bombs or helping communities solving their problems. It is simply not wise to ignore the positive side of powerfull knownledge.

A child this days should learn how to properly use smartphones. If you don't care about it, bad things may happen. Right now, we all are childrens with a new super powerfull tool in hands. We should learn how to use it for good. 
« Last Edit: December 16, 2023, 01:31:49 am by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1422
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #20 on: December 16, 2023, 07:09:56 am »
Can anyone elaborate upon the details of how ai works? Perhaps I would like to write some ai myself using pascal.

If history serves as any reference at all, every single technology that humans have ever invented/discovered seems to end up being used Either directly or indirectly for killing other humans in large numbers. Ai is no exception.

Sometimes new technologies solve problems but more often than not the new technology creates more complicated problems. I think we should be far more judicious in which technologies we adopt and think about all the possible bad consequences of using them.

Quote
A child this days should learn how to properly use smartphones. If you don't care about it, bad things may happen. Right now, we all are childrens with a new super powerfull tool in hands. We should learn how to use it for good. 
I’ve heard that people who develop smart phones don’t let their kids near them.  Humans with powerful tools have a lot in common with monkeys with hand grenadines  :o

Also one more thing I’d like to add. New technology is not the only Type of technology that exists/matters. There is plenty of old knowledge  which has been suppressed because greedy people with financial interests want it that way.. so already we are going in the wrong direction.
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

colo

  • New Member
  • *
  • Posts: 48
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #21 on: December 16, 2023, 11:10:06 am »
Can anyone elaborate upon the details of how ai works?

I found this article very accessible when trying to understand how some of contemporary "AI" systems (esp. the generative stuff that is cropping up everywhere) work: https://www.astralcodexten.com/p/god-help-us-lets-try-to-understand

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12195
  • FPC developer.
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #22 on: December 16, 2023, 11:25:57 am »
Just to put it on perspective. The Free Pascal team are formed by really smart people with excellent pascal vocabulary, but they have very limited resources, and a small team. AI-assisted tools may help a lot in this scenario as long as the team agreed about some time-saving tasks that could be done with theses tools.

Most of it is still future predictions rather than reality, or demonstrations for a limited set of programming languages that the model has been trained for.   But it would be nice to see what a Pascal language copilot can do (I guess first in something as vscode that will get integration sooner or later) before making any rash decisions.

Dzandaa

  • Sr. Member
  • ****
  • Posts: 428
  • From C# to Lazarus
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #23 on: December 16, 2023, 12:39:58 pm »
Hi
@colo:

Very interesting article, thank you.

B->
Regards,
Dzandaa

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #24 on: December 16, 2023, 12:58:56 pm »
Can anyone elaborate upon the details of how ai works? Perhaps I would like to write some ai myself using pascal.


Hugging face have really comprehensive detailed documentation (https://huggingface.co/).

To give you a really brief summary, all state-of-the-art machine learning uses feedback functions (reinforcement learning) to teach virtual neural networks to do stuff. You should keep in mind that virtual neural networks are far more simple than its biological counter part. Real neurons, for example, may suffer interference by nearby neurons. You don't need to implement that sort of thing. However, the machine will start doing usefull stuff only after a massive number of training steps. And it takes a lot resources to achieve this.

Different approachs exists. For example, you can start from zero to create a model or start by fine tunning an existing model. To start from zero, you would need a lot of data for training (OpenAI used the whole public internet in english). You also need well defined feedback functions, and a pipeline to go back, foward, and make exceptions as needed (machines can get stuck, just like humans trying to learn something new). One approach is supervised learning. Now and them, you take a look at the learning processes and make manual adjustments. Of course, you may combine supervised learning with non-supervised learning, embeeding some automation steps in the process.

GPT models learned to translate from english to other languages, to code, to summarize, to write poems, to write templates and text snnipets using specif styles, and are slowly learning math. People quickly noticed that GPT learned bad things too related to being able to assist people to commit crimes, prejudice, and the so called "fake news". 
« Last Edit: December 16, 2023, 01:00:37 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

domasz

  • Hero Member
  • *****
  • Posts: 576
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #25 on: December 16, 2023, 01:01:07 pm »
I tried some AI tools, including ChatGPT, and the code was shit. At first it looked like it saved me some time but results were wrong, the code was slow or broken in just some cases.
I am really surprised any of you find any value in those AI tools.

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #26 on: December 16, 2023, 01:23:04 pm »
Most of it is still future predictions rather than reality, or demonstrations for a limited set of programming languages that the model has been trained for.   But it would be nice to see what a Pascal language copilot can do (I guess first in something as vscode that will get integration sooner or later) before making any rash decisions.

I think some sort of integration already exists, let me try to explain. To improve my chances of get things done faster, one thing I am trying to do is to use VSCode and GitHub Copilot Chat with the @workspace directive to talk with specific parts of my Object Pascal code. I noticed that it will fail more often in the sintax. However, for language agnostic stuff (design patterns) and brainstorm it is doing a good work.

For example, I was strugling to learn how to make a complex class persistent. I really have no clue at all on how to do this. I don't even known if there is an open source library for this.

So, here is the answer they give it to me:
Quote
To save and load TSessionCounters as a binary file in Pascal, you can use the BlockWrite and BlockRead procedures. Here's a step-by-step plan:

Open a file in binary mode using AssignFile and Reset or Rewrite.
Use BlockWrite to write the TSessionCounters instance to the file.
Close the file using CloseFile.
To load the data, open the file in binary mode using AssignFile and Reset.
Use BlockRead to read the data into a TSessionCounters instance.
Close the file using CloseFile.
Here's the Pascal code:
Code: Pascal  [Select][+][-]
  1. var
  2.   F: File;
  3.   Counters: TSessionCounters;
  4. begin
  5.   // Save to file
  6.   AssignFile(F, 'counters.bin');
  7.   Rewrite(F, 1);
  8.   BlockWrite(F, Counters, SizeOf(Counters));
  9.   CloseFile(F);
  10.  
  11.   // Load from file
  12.   AssignFile(F, 'counters.bin');
  13.   Reset(F, 1);
  14.   BlockRead(F, Counters, SizeOf(Counters));
  15.   CloseFile(F);
  16. end.
  17.  

Please note that this approach works only if TSessionCounters is a simple record type without any dynamic data (like strings or dynamic arrays). If TSessionCounters contains any dynamic data, you'll need to serialize and deserialize it manually or use a library that can handle this.

Of course, I known I can't trust in everything but now at least I known that serialization and deserialization exists. The approach is language agnostic and it doesn't matter if this specific snnipet is sintatically wrong (I really do not have a clue right now).
Be mindful and excellent with each other.
https://github.com/cpicanco/

FrankBKK

  • New Member
  • *
  • Posts: 42
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #27 on: December 16, 2023, 02:01:41 pm »
I tried some AI tools, including ChatGPT, and the code was shit. At first it looked like it saved me some time but results were wrong, the code was slow or broken in just some cases.
I am really surprised any of you find any value in those AI tools.

I agree - in part that is - don't trust code you did not write (or at least test) yourself.

However I make good use on AI tools to overcome one of the biggest issues I have with Lazarus and Pascal - the imo really lousy documentation.
Sure, I can find anything if I just dig long enough into other people's source code or spend hours on forums and search engines but tbh that just costs an awful lot of time - a resource I came to value over the years above all else ...

AI tools like phind are invaluable to circumvent such issues and quickly and effortlessly find answers to mostly simple but very specific questions.
Sometimes the answers are partially correct, sometimes (to a much lesser extend) wrong - but they always point me in the right direction and help me save a lot of time.


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12195
  • FPC developer.
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #28 on: December 16, 2023, 02:04:48 pm »
For example, I was strugling to learn how to make a complex class persistent. I really have no clue at all on how to do this. I don't even known if there is an open source library for this.

The problem is that the answer is wrong.  Classes are pointers, so all that code does is writing the address of the class instance in memory (the pointer value) to disk, a common beginner pitfall (that apparently also AI suffers from)

Which basically proves my point. Lots of emotive demonstrations, little practical use.

cpicanco

  • Hero Member
  • *****
  • Posts: 662
  • Behavioral Scientist and Programmer
    • Portfolio
Re: The winter is coming (AI-assisted coding and its influence on Free Pascal)
« Reply #29 on: December 16, 2023, 02:28:40 pm »
Quote
Which basically proves my point. Lots of emotive demonstrations, little practical use.

I am affraid to disagree. You are ignoring the last part.  Please, it is "assisting" me doing some work, not doing the work. The practical use for me is learning and moving me foward.

Quote
If TSessionCounters contains any dynamic data, you'll need to serialize and deserialize it manually or use a library that can handle this.

So, as I knew that "Counters" have just the class address and the answer pointed to some manual task, I asked:

Quote
@workspace , give me step by step instructions to manually serialize the TSessionCounters class into a binary file and save it to disk.

And the answer was:

Quote
Since TSessionCounters is a class with complex fields, you'll need to manually serialize each field into a binary format. Here's a step-by-step guide:

1. Create a new method in the TSessionCounters class for serialization. This method will convert each field of the class into a binary format and write it to a file.
Code: Pascal  [Select][+][-]
  1. procedure TSessionCounters.SaveToFile(const FileName: string);
  2. var
  3.   F: File;
  4. begin
  5.   AssignFile(F, FileName);
  6.   Rewrite(F, 1);
  7.   try
  8.     // Write each field to the file
  9.     BlockWrite(F, ID, SizeOf(ID));
  10.     FTree.SaveToFile(F);
  11.     FBlock.SaveToFile(F);
  12.     FTrial.SaveToFile(F);
  13.   finally
  14.     CloseFile(F);
  15.   end;
  16. end;

2. Implement the SaveToFile method for each of the TIDSessionCounter, TBlockCounters, and TTrialCounters classes. These methods should serialize each field of these classes in a similar way.

3. To save a TSessionCounters instance to a file, call the SaveToFile method.

Code: Pascal  [Select][+][-]
  1. var
  2.   Counters: TSessionCounters;
  3. begin
  4.   Counters := TSessionCounters.Create;
  5.   try
  6.     // ... (initialize and use Counters)
  7.     Counters.SaveToFile('counters.bin');
  8.   finally
  9.     Counters.Free;
  10.   end;
  11. end.

Please note that this is a simplified example. The actual implementation of the SaveToFile methods will depend on the fields of the TIDSessionCounter, TBlockCounters, and TTrialCounters classes. If these classes contain dynamic data (like strings or dynamic arrays), you'll need to handle this in your serialization code.
Be mindful and excellent with each other.
https://github.com/cpicanco/

 

TinyPortal © 2005-2018