Recent

Author Topic: New language features?  (Read 29482 times)

xixixi

  • New Member
  • *
  • Posts: 25
New language features?
« on: June 15, 2023, 05:52:47 pm »
What's the policy of the Free Pascal developers regarding the addition of new language features?

Is it to strictly copy Delphi and not add new features unless Delphi does it first, or are they open to (incompatible) language changes?

Fibonacci

  • Hero Member
  • *****
  • Posts: 788
  • Internal Error Hunter
Re: New language features?
« Reply #1 on: June 15, 2023, 06:06:46 pm »
Is it to strictly copy Delphi and not add new features unless Delphi does it first

Yep it's like that

Bad Sector

  • Jr. Member
  • **
  • Posts: 69
    • Runtime Terror
Re: New language features?
« Reply #2 on: June 15, 2023, 06:22:07 pm »
Language compatibility shouldn't be a concern since the compiler has different modes (e.g. {$MODE OBJFPC} vs {$MODE DELPHI}) anyway.

I think a bigger concern is new features make the compiler harder to maintain so my understanding is that the FPC devs tend to be conservative with what they accept to avoid making it unmaintainable.
Kostas "Bad Sector" Michalopoulos
Runtime Terror

Warfley

  • Hero Member
  • *****
  • Posts: 2038
Re: New language features?
« Reply #3 on: June 15, 2023, 06:29:23 pm »
There are a few language features that where added before delphi had them and therefore still work quite differently. Generics come to mind, thats why we have the keyword specialize, or also generic non method functions. Another thing is operator overloading, which is why in Delphi there is only "class operator" but in FPC you can make global operators.
The most recent feature is Management Operators, which is an amazing feature (if it works) that delphi completely lacks

I think the main thing about adding new features is simply that while the list of potential features to add is quite long, there are just a few developers for FPC and just a limited amount of hours in the day. I think the next big language feature is extended RTTI, which will bring RTTI to non class types as well as to non published fields. And this is already worked on for a few years I think.
« Last Edit: June 15, 2023, 06:32:10 pm by Warfley »

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: New language features?
« Reply #4 on: June 15, 2023, 06:38:16 pm »
Is it to strictly copy Delphi and not add new features unless Delphi does it first

Yep it's like that
No it is not! Usually Freepascal has new features first. That said, if Delphi comes up with a useful feature Freepascal tries to implement those to be compatible. FreePascal has many features that Delphi misses....
Delphi has only a few features that FreePascal misses, and mostly not compiler related, but library related.
Let alone platforms support....
« Last Edit: June 15, 2023, 07:05:04 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

PascalDragon

  • Hero Member
  • *****
  • Posts: 6315
  • Compiler Developer
Re: New language features?
« Reply #5 on: June 15, 2023, 10:27:53 pm »
Is it to strictly copy Delphi and not add new features unless Delphi does it first, or are they open to (incompatible) language changes?

We are very conservative about adding new language features, because
a) they have to be maintained
b) one needs to ensure that they indeed enrich the language, allowing something new that isn't easily doable otherwise

Mere syntactic sugar for example will only be added if it's required by an existing language (e.g. Delphi features or the otherwise-keyword from ISO Extended Pascal).

The most recent feature is Management Operators, which is an amazing feature (if it works) that delphi completely lacks

Current Delphi versions do have managed records as well.

xixixi

  • New Member
  • *
  • Posts: 25
Re: New language features?
« Reply #6 on: June 17, 2023, 03:03:40 am »
I'm glad it isn't completely ruled out. In my opinion the stewardship (so to speak) of the Pascal language belongs now to FPC, so they shouldn't be shy in improving it as UCSD and Borland did in the past.

In my case, I use FP because of the libraries and tools. I'm not particularly fond of the language, which lacks some basic niceties that almost every other imperative language adopted decades ago. So it's good to know there's room for evolution.

440bx

  • Hero Member
  • *****
  • Posts: 6075
Re: New language features?
« Reply #7 on: June 17, 2023, 05:58:57 am »
We are very conservative about adding new language features, because
a) they have to be maintained
Quite reasonable.

b) one needs to ensure that they indeed enrich the language, allowing something new that isn't easily doable otherwise
So far, that does not seem to be a rule that is applied with much, if any, consistency.  Features have been rejected simply because they could be implemented in some way in spite of the fact that their implementation was either not easy nor the result easy to understand.

In a few cases (at least one comes to mind), I'd go as far as stating that the "new feature" was actually a bug that needed to be fixed but the developers, including you, refused to acknowledge the behavior as a bug.

FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

LV

  • Sr. Member
  • ****
  • Posts: 411
Re: New language features?
« Reply #8 on: June 17, 2023, 08:53:34 am »
I gratefully use Free Pascal as it is. You can find less conservative dialects of Pascal. For example, young PascalABC.net , where only "begin .. end" has been preserved from the Pascal language, as it seems to me

VisualLab

  • Hero Member
  • *****
  • Posts: 712
Re: New language features?
« Reply #9 on: June 17, 2023, 06:24:50 pm »
I'm glad it isn't completely ruled out. In my opinion the stewardship (so to speak) of the Pascal language belongs now to FPC, so they shouldn't be shy in improving it as UCSD and Borland did in the past.

Agreement. I also expect improvements in the language (actually, the compiler, because without it, the programming language is just a fanciful collection of whims). However, people evaluate something new differently. For some it will be a significant improvement and for others it will be a breakdown of what was working well. So, life is hard for people developing established programming languages. Because there will always be a group that will be dissatisfied. I think that some slight conservatism of the current FPC group is quite OK.

I'm not particularly fond of the language, which lacks some basic niceties that almost every other imperative language adopted decades ago.

Interesting statement. I'd love to know what subtleties, used in other languages for decades, are missing in FPC. Or maybe like Java which still doesn't have unsigned integers? Or something like properties and events that C++ still doesn't have? Or is it not possible to compile source code to machine code as in the case of C#? Or maybe no types like in Python and PHP (not to mention no compilation)?

Since when do all other imperative languages have modern subtleties adopted "decades ago"? And which languages? When referring to decades, they must be plural, i.e. at least two - which is a minimum of 20 years. Counting from today, it would be 2003. At that time, Java was a very young language, most of its features important today did not exist then. So does C#. These were his beginnings. "C++ reformed" (significantly), it's only been around "more or less" since 2011 (C++11, C++14, etc.). That's barely 12 years ago, a lot, but it's still not decades. In 2003, C++ was much simpler and a little clearer (although saying that C++ is transparent may make many people laugh or annoy). Python or PHP in 2003 were not very popular (PHP was probably more popular then). And they both sucked back then (and still do). D didn't even exist in the mind of its creator back then. No one knew that Rust would appear, and its creator probably didn't even know anything about programming at the time (simply, he was too young). It was the same with GO (didn't exist then). JavaScript, it was a monstrous mess (much worse than today).

To sum up. Object Pascal has some minor shortcomings. But against the background of other, "dignified" languages (C++/C#/Java) it is absolutely OK. The libraries are also decent. And how many open source environments like Lazarus exist for C++? Because I don't see it.

Of course, criticism is OK. But it's interesting when it's specific.

---
*) I, for example, criticize "certain" :) open source project from the point of view of a regular user and a programmer. But I always try to state what annoys me and why. Of course, not all of my arguments are relevant.

Warfley

  • Hero Member
  • *****
  • Posts: 2038
Re: New language features?
« Reply #10 on: June 17, 2023, 07:11:50 pm »
Interesting statement. I'd love to know what subtleties, used in other languages for decades, are missing in FPC. Or maybe like Java which still doesn't have unsigned integers? Or something like properties and events that C++ still doesn't have? Or is it not possible to compile source code to machine code as in the case of C#? Or maybe no types like in Python and PHP (not to mention no compilation)?
Well there are a few trends that most imperative language follow. Maybe Java is an exception here, because Java is generally extremely conservative in adding new features, but aside from that, most languages follow a similar path.

Some of these features are:
  • Language level Parallelism, most often in form of async await style coroutines (often not threaded)
  • Algebraic datatypes and pattern matching
  • Anonymous functions (lambdas/closures)
  • Non nullable pointers
  • Explicetly nullable values
  • Streams and streamfunctions (map, filter, reduce, etc.)
  • ReadOnly datatypes and objects
  • Language level Tuples
  • Generics/Compile time Polymorphism
  • Runtime code information and changes (RTTI, reflection, etc.)

And those are just the ones come from the top of my head. Note that some of those are also already in Pascal or are currently worked on. Some of those are language level and some are more a matter of libraries (which is often hard to distinquish from one another).

So yes, while of course are languages are different, there is a common trend since the mid 2000s/early 2010s, often driven by the success of "new" language paradigms (not really new, most of them were already developed in the 70s and 80s, but have been rediscovered when people noticed that OOP is not the be all and end all), that have shown success in newer languages like swift, kotlin, go, rust, python, javascript, etc.
« Last Edit: June 17, 2023, 07:15:56 pm by Warfley »

xixixi

  • New Member
  • *
  • Posts: 25
Re: New language features?
« Reply #11 on: June 17, 2023, 07:22:25 pm »
I was thinking of even more basic stuff, like having real (non-reassignable) constants, or the the ability to have blocks inside statement lists to reduce the scope of declarations. Everybody has those since forever. The only current language where declarations have to be far away from usage is Pascal...

Warfley

  • Hero Member
  • *****
  • Posts: 2038
Re: New language features?
« Reply #12 on: June 17, 2023, 08:07:20 pm »
Well for pascal not having scoped variables is pretty much one of the core principles of the language. And the thing is, if you are running into the problem that you want to scope your variables, you can simply put that code into a new function. Pascal has nested functions which are really useful to structure your code.
Also remember the rule of thumb is max 20 lines of code per function, if you have much more than that, you should recosinder splitting it up anyway

VisualLab

  • Hero Member
  • *****
  • Posts: 712
Re: New language features?
« Reply #13 on: June 17, 2023, 10:39:41 pm »
Some of these features are:
  • Language level Parallelism, most often in form of async await style coroutines (often not threaded)
  • Algebraic datatypes and pattern matching
  • Anonymous functions (lambdas/closures)
  • Non nullable pointers
  • Explicetly nullable values
  • Streams and streamfunctions (map, filter, reduce, etc.)
  • ReadOnly datatypes and objects
  • Language level Tuples
  • Generics/Compile time Polymorphism
  • Runtime code information and changes (RTTI, reflection, etc.)

And those are just the ones come from the top of my head. Note that some of those are also already in Pascal or are currently worked on. Some of those are language level and some are more a matter of libraries (which is often hard to distinquish from one another).

Hmm... This is a dilemma: what to "push" into the compiler and what to leave in the libraries. After years of development, the language can be very bloated and difficult to maintain (complicated compiler).

As you know, languages such as JavaScript, PHP, Python or Ruby, due to their foundations, are not suitable for creating large software, especially one that is to be as fast and effective as possible (lowest CPU load, lowest RAM consumption, etc.). So it's probably nothing to worry about them. However, you certainly need to keep track of what is being introduced into C++ or even C# (but to a lesser extent).


So yes, while of course are languages are different, there is a common trend since the mid 2000s/early 2010s, often driven by the success of "new" language paradigms (not really new, most of them were already developed in the 70s and 80s, but have been rediscovered when people noticed that OOP is not the be all and end all), that have shown success in newer languages like swift, kotlin, go, rust, python, javascript, etc.

But how long will this trend last? In the history of IT, certain trends (fashions) came and went, and then returned after many years. So it was with AI. It's probably 3rd (or 4th) now. It was the same with the so-called "expert systems". They were supposed to solve all problems, many years ago it was predicted that in the future they would solve practically all technical problems. This did not happen (although many of them are useful in narrow applications). Or maybe in a few years there will be a turn towards simplifying programming languages and at the same time pressure to transfer advanced algorithms to libraries? Maybe V, Zig or Carbon are the harbingers of these changes?

VisualLab

  • Hero Member
  • *****
  • Posts: 712
Re: New language features?
« Reply #14 on: June 17, 2023, 10:45:45 pm »
I was thinking of even more basic stuff, like having real (non-reassignable) constants, or the the ability to have blocks inside statement lists to reduce the scope of declarations. Everybody has those since forever. The only current language where declarations have to be far away from usage is Pascal...

Yes, about constants without any possibility of change, I agree (writeable typed constants). However, as for declaring variables (etc.), I have an opinion similar to what Warfley wrote.

 

TinyPortal © 2005-2018