On 10/17/24 10:01 PM, Santi via fpc-pascal wrote:
El 16/10/2024 a las 05:12, Joao Paulo Schwarz Schuler via fpc-pascal escribió:
Some half baked ideas:
* month after month, the percentage of code coded by AI grows and human made shrinks.
* could Pascal be the ideal language coded (or preferred) by AI?

Given that Pascal is strongly typed, easy to read and debug, avoids many types of bugs, could we make AI to prefer pascal?

Pascal opened the path with structured programming and hard typed languages.

But most languages nowadays are hard typed: Java, rust, go, c#, swift... c is here to stay, but modern language got rid of c-like types byte=char=bool=everything. In fact modern development uses tools to control types in c and c++.

I'm sorry to say than other language are better, handier without sacrificing security and readability.

On the contrary, I've used some of the so called "modern" languages and found them to be inferior to Pascal in some regards. Especially, if you include things like runtime performance, compilation speed, IDE experience, ease of writing code, etc. I've used C, C++, Java, C#, Nim, Rust, Python, JavaScript. They all suck. C# and Nim come close to being good, but still have drawbacks.

C# is slow and bloated and I don't like the fact that it forces you to use classes always, like Java. On the other hand, C# has an excellent IDE experience, but only for Windows.

Nim is nice from a language design point of view, however it has slow compilation speeds (compiler generates C code), bad IDE experience (VS Code plugin), bad debugger experience (compiler generates C code, debug info is generated for the C code, not the Nim code), not a lot of libraries (and they lack stability), not a very stable language (new versions break compatibility, especially major versions), not a very advanced OOP support (supports inheritance and virtual methods, but e.g. no interfaces), the module system is also inferior - no interface and implementation parts, no way to tell if something is a unit, or a program, etc. The powerful macro system is a pro, but also a con, because it's so easily abused by bad programmers.

The other languages are not even worth discussing, IMO. I know Rust has a lot of fans. I've been writing Rust professionally for almost a year now, and still find it to be one of the most unpleasant languages to write code in. The borrow checker is certainly not something I want to see in other languages. Anyhow, it's a feature that is very unlikely to creep into Pascal, IMO. If I have to do manual memory management, I prefer Object Pascal's explicit way, instead of languages that hide it for you (by using the RAII idiom or the borrow checker), and then still expect from the programmer to fix things, when the automatics fail.

A few points:

  * Concurrency as part of the syntax of the language

What do you mean? Do you mean stuff like OpenMP or is it something else?

  * Declaring a var when you need it

Not a huge fan, but AFAIK latest Delphi has it, so we probably need to support it in FPC. Anyhow, it's cosmetic at best. It's not some "quality of life" type of issues, like the slow C++ compilation times, or the encouragement of buffer overflows. When I need to use a local var declaration, I usually consider that my procedure or function has become too complex and split it into nested procedures. Also, Lazarus declares the variable automatically for you, when you press Ctrl+Shift+C, so it's even less of an issue. You just write:

i := 1;

Or:

for i := 1 to 10 do

You then move the cursor on top of "i" and press Ctrl+Shift+C and it declares a "i: integer" automatically in the local var block. And yes, it does automatic type inference.

  * Tuples, so easy to return two values

Nice in theory, but I've used tuples in other languages and always hit some roadblock. For example in Rust, I've had to switch from using tuples to using structs several times, because of some language quirks, that doesn't handle tuples somewhere. Anyhow, the lack of tuples is only cosmetic, it's not a serious "quality of life" issue. It's easy to declare a record type with two elements, or an array.

  * Some functional programing

Not a huge fan of functional programming either (out of the big three - procedural programming, object oriented programming, functional programming, I consider functional to be the least useful - worst in performance, does not map well to how the CPU works, is elegant only for a very restricted set of tasks), however FP features are coming to FPC as well, for example FPC trunk supports anonymous functions.

And all those languages are backed by big corporations.

Lazarus is for Delphi nostalgic guys, like me. I'm sure 90% of Lazarus users have worked professionally with Delphi before.

Not me. I really think Free Pascal is an improvement over many "modern" languages. When I say some of the issues are not "quality of life" issues for me, means that I would never trade things like 10 times faster compilation speed or the runtime speed for something like tuples or having the ability to declare vars everywhere.

Nikolay
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to