Lazarus

Programming => General => Topic started by: hnb on May 02, 2018, 08:05:40 pm

Title: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 02, 2018, 08:05:40 pm
Hello,

I was kicked away today from FPC core team (by Michael Van Canneyt).

Insulting and destructive approach by Michael Van Canneyt (with silent acceptance from other persons in core team) is unacceptable (the good example can be found in topic "[fpc-devel] What's the status of Maciej's Smart Pointer enhancements?" from 29 April 2018). IMO this is not the way how good open source project should work.

I leave it to everyone for individual evaluation, here is short summary:

http://lists.freepascal.org/pipermail/fpc-devel/2018-May/038886.html

I will continue my all work as much as possible with NewPascal (which will be synced with FPC trunk few times in the year - or more often if needed), I mean here all stuff, including updates for Generics.Collections library, bug fixes for compiler and generics, smart pointers/ARC/nullable types, oxygene mode, closures and extended RTTI.

I've suspended the NewPascal foundation (it was not officially registered yet) and the idea of the NewPascal for the good of whole community (finally one project is better than divided community). I was trying to put all my energy into official FPC but it seems impossible. Every person has a dignity, and the unacceptable line of insulting in many fields was crossed many times.

Note about Generics.Collections:

the library is important for many programmers, so everyone who is using Generics.Collections should use :

https://github.com/maciej-izak/generics.collections

the FPC trunk version will be not updated anymore so if someone is using this library should definitely not use official FPC trunk version. Any bug report about Generics.Collections should be filled in my github repo (in current situation usage of official bug tracker in this matter has no sense).

The next place with actual Generics.Collections will be http://NewPascal.org distribution (which will be updated soon) - the distro was not intensively update because I was too much naive in my faith for FPC progress. NewPascal was intended as part of official FPC which in current situation is impossible.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: balazsszekely on May 02, 2018, 08:23:26 pm
Sorry to hear that. It's a shame that you could not overcome your differences.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Pascal on May 02, 2018, 09:53:00 pm
Sorry to hear!!!

http://lists.freepascal.org/pipermail/fpc-devel/2018-May/038886.html
I think you overreacted. But maybe this was just the straw that breaks the camel's back.

Anyway, i appreciate your work very much. Especially Generics.Collections! Many thanks!
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: PatBayford on May 03, 2018, 01:49:42 am
Sad news, especially that the Generics.Collection will no longer be maintained within FPC trunk.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Akira1364 on May 04, 2018, 09:36:14 pm
This is extremely unfortunate! I personally like to stay up to date on the latest trunk (as big improvements can be made one day to the next), and I was hoping that the additions you've made in terms of things like anonymous methods and smart pointers would finally be merged soon. It all seems to work properly, so I've never understood what the reason for not doing so was.

These are highly useful features that I'm sure a lot of other people have been eagerly waiting on for a long time as well. I'm quite certain there's far more programmers who want them than those who don't. I even know several people who have considered starting to use FPC, but ended up not doing so simply because it lacked those capabilities.

Will your repository at least be connected in some way to perhaps Graeme G's mirror of the official trunk, so that people who want to attempt to keep it in sync can do local merges themselves? For me at least, updating my sources only a few times a year wouldn't be anywhere close to enough.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 04, 2018, 10:24:46 pm
Oh, well, Maciej, you have a temper bigger than my pseudo-temper. ( <grumpy  >:D >:D >:D> )

I am sure this will calm down with time.

I can understand Michael: boils down to being precise and complete with new language features. Already in the design stage.
Not features for the sake of features.

I respect both of you and both of you know that. Will be OK. Don't be silly....No point to it.... O:-)
The one is over-protective the other one is like a little child that wants to push too hard.

Oh, well... :P

My impression is there is not a personal dislike, just a strongly phrased matter of opinionated minds.
Which is actually a good thing....

Maybe something to discuss for you all in the beach house in Castricum aan Zee. (Sleeps 8, power fuse will blow with 8 laptops  :o ). I will bring barbecue and perform small service but will sleep at home in Krommenie. (Yes it is actually ON the beach. And we combined two beach houses into one)
Take it or leave it. This is a serious offer and many of you have my phone number or email. (The core team including Maciej)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 04, 2018, 10:55:33 pm
And I can evacuate any casualties to Krommenie... sleeps many.... If needed. Not luxury %) but does the job....
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 05, 2018, 02:13:38 am
Will your repository at least be connected in some way to perhaps Graeme G's mirror of the official trunk, so that people who want to attempt to keep it in sync can do local merges themselves?

I think that I have good informations for you,

1. NewPascal has a special branch "freepascal" synchronized (every 15 minutes) - it is just FPC trunk mirror, see :

https://github.com/newpascal/freepascal/tree/freepascal

2. this is base for any further work. For example when I have ready some feature on my local fork/branch (in account "maciej-izak", which was forked from newpascal repository), for example:

https://github.com/maciej-izak/freepascal/tree/closures

3. the ready to use feature is merged into "master" branch of https://github.com/newpascal/freepascal

so when someone needs latest FPC trunk + my latest features the way to go is very simple:

pull from master branch -> pull from freepascal branch -> merge freepascal branch into master.

This is all (in the case of any conflict  between master and freepascal branches, additional action from my side is needed, but the conflicts are rather rare).

I need to back to NewPascal work, the project NewPascal was not up to date because I was thinking that my work in FPC core was more important...
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 05, 2018, 02:37:22 am
I respect both of you and both of you know that. Will be OK. Don't be silly....No point to it.... O:-)
The one is over-protective the other one is like a little child that wants to push too hard.

Oh, well... :P

My impression is there is not a personal dislike, just a strongly phrased matter of opinionated minds.
Which is actually a good thing

being at peace, far away from insults and unfair appreciations, especially on public, is a due, this is all what I want. From Michael Van Canneyt I have got many insults and unfair appreciations.

What Michael Van Canneyt said about current situation:

Quote
I and I alone take full responsibility. I have only warned Florian Klaempfl in advance that this could happen, none of the other members have anything to do with this.

My banishment is caused by personal revenge of Michael Van Canneyt. I have no influence on this. The only what I need (I will repeat it again) is : being at peace, far away from insults and unfair appreciations.

I will continue my work in other way, I will not drop my dreams about modern and NewPascal.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 05, 2018, 03:06:10 am
I like your approach. This way we could get best of both Free Pascal and New Pascal.

So, while we're talking about a new and modern Pascal, can you provide named parameter feature? I think it's good and fit with Pascal's philosophy.

Here's my proposal for named parameter:
Code: Pascal  [Select][+][-]
  1. // PASCAL NAMED PARAMETER PROPOSAL
  2. // AS {$MODESWITCH NAMEDPARAMETER}
  3.  
  4. // function declaration with some default values
  5. function f(i: integer = 0; s: string = ''; d: double): boolean;
  6. begin
  7.   result := true;
  8. end;
  9.  
  10. // Old-fashion function calling,
  11. // all params must be in order but
  12. // allowed to skip default params.
  13. f(0.1);         // filling only d param
  14. f('abc',0.1);   // filling s and d params
  15. f(3,'abc',0.1); // filling all params
  16.  
  17. // New style mixed function calling,
  18. // still respects the params order,
  19. // if NOT all params name is given.
  20. f(s := 'def', 0.2);
  21. f(4, s := 'def', 0.2);
  22.  
  23. // New style named param calling,
  24. // params don't need to be in order,
  25. // if ALL params name is given.
  26. f(d := 0.3, i := 5);      // s = default
  27. f(s := 'ghi', d := 0.3);  // i = default
  28. f(i := 5, d := 0.3, s := 'ghi');
  29.  
  30. // Fills param using other variable,
  31. // compiler knows which is what.
  32. s := 'text';
  33. d := 0.4;
  34. f(s := s, d);
  35. f(d := d, s := s);
  36.  
  37. // It should also work with `procedure` as well.

What do you think?

If NewPascal provides this feature, I will instantly move to NewPascal in a heart beat. :)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 05, 2018, 07:27:00 am
Dunno, if this is good news or bad. What I REALLY need - is full Delphi 2009 compatibility. I can't port my projects to Lazarus without it. I need full generics, Unicode and closures support. D2009 was released almost 10 years ago and Lazarus still isn't compatible with it. If Lazarus will be D2009 compatible some day - I will be able to completely switch from Delphi to Lazarus. And I really want to do it, as Delphi is extremely overpriced in a first place. And it's extremely limiting - I have to constantly find workarounds to fix bunches of out of memory, internal compiler errors and some other bugs. This workarounds overcomplicate my code, make it heavier and slower. But I have to deal with it now.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: PascalDragon on May 05, 2018, 02:45:10 pm
Sad news, especially that the Generics.Collection will no longer be maintained within FPC trunk.
I'll probably keep a look on Maciej's changes there and reintegrate them with trunk (as long as he doesn't change the license to something incompatible that is  :P )
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Akira1364 on May 05, 2018, 03:50:08 pm
This is all (in the case of any conflict  between master and freepascal branches, additional action from my side is needed, but the conflicts are rather rare).

Just so you know, none of your branches (or at least not record-default-field and closures, which are the two I'm most interested in) are currently mergeable with trunk. They all do have multiple conflicts.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 06, 2018, 02:46:39 am
@bee every idea is welcome in NewPascal, I was not thinking about this feature yet, but looks promising and is worth to investigate! This may be a little delayed because I have a lot of work with reactivation of NewPascal. But when I finish I will back to this for sure.

@Akira1368 master branch is now updated, sorry for inconvenience but project was not updated for long time (I was really busy on my work for FPC core including compiler and RTL and additionally I was working on new official page for official FPC, where NewPascal was important part of new page...).

Current "master" branch of https://github.com/newpascal/freepascal already contains record-default-field and is synced in proper way with latest FPC trunk. You should be able to merge "freepascal" branch into "master" without problems and you can test default field for smart pointers ( https://github.com/maciej-izak/PascalSmartPointers ) . "closures" branch in my local repo is in-progress so no surprise here.

@PascalDragon ...
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 06, 2018, 03:50:06 am
@bee every idea is welcome in NewPascal, I was not thinking about this feature yet, but looks promising and is worth to investigate! This may be a little delayed because I have a lot of work with reactivation of NewPascal. But when I finish I will back to this for sure.

Thank you. I really appreciate your attention and I'll look forward to your promise.

About the new website, I think you better focus on your own New Pascal website. Make New Pascal as modern as it can be. Personally I don't like both the official FPC's and Lazarus' websites because they look so old. They're like made in the 2000's.

If you want to make New Pascal looks new and modern so it impresses programmers from other languages and new comers alike, please make New Pascal website looks cool and elegant. Use something like Bootstrap templates for the website, and use something like Discourse for the forum.

Let's make New Pascal be forward-compatible and let FPC handles the backward-compatible. Let's make Pascal modern and cool again! :)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Pascalist on May 06, 2018, 04:58:05 am
I'll go wherever Generics.Collections goes, personally! It's definitely more important than even Maciej realizes I think... who doesn't use it? All of the classes in it are faster than any other that exists in FPC, and also use less memory because everything is stored as what it actually is, instead of an untyped pointer. Plus who wants to be constantly writing stupid typecast-heavy code like
 
Code: Pascal  [Select][+][-]
  1. TSomething(TAnotherThing(TLastThing(TObject))))

anymore? There's just no logical reason not to use generics...
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 06, 2018, 08:53:05 am
they say variables aren't initialized for example, but everyone knows that of course they are.....
What make you think that? (Global) Variables on the heap may be initialized - that's implementation detail, imo -, but local variables are not!
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 07, 2018, 03:46:15 am
@Bee: Am I the only one who has noticed that the doc links on the FPC website still direct to the 3.0.2 docs, even though the 3.0.4 docs obviously exist? And there's more than a little bit of incorrect information in them in general as well... they say variables aren't initialized for example, but everyone knows that of course they are.....

It's not a problem. The difference between the two versions isn't too much anyway. The official techinal documentation of FPC is actually pretty good, I think. It just doesn't look very nice.

The real problem is it lacks of guidance documentations, such as Getting Started and How Tos, especially on the Lazarus side. Actually, there are many gems hidden within the repos, but nobody knows about them because there's noone shows them of to the world. If you talk about this to the core devs, they'll scream "you do it if you want it". Well, I can't blame them since both FPC and Lazarus are volutary-based open source projects. But since nobody really do anything about it, why don't core devs starting to make one by themselves? At least as an example to the others to make another one.

And I heard that FPC already has a foundation or something. Does it mean it finally has some kind of financial support? If that so, I think they need to hire professional people to do these things:
1. Migrate all the codes to github so it's more visible to the outside world, including the code management tools (issues, etc).
2. Build a great and complete documentations.
3. Make a brand new website and forum that looks modern.
4. Plus make some marketing noises on the internet and social media.

Let the world knows that we have a new and modern Pascal.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: RAW on May 07, 2018, 06:40:37 am
How about a HELLO LAZARUS program ???
Not like the normal "Hello World" programs... I mean a program that is able to show all the basic stuff that you need in one program. Is that too much or can that be done. Maybe even with some advanced examples for important things...

Everything a Newbie must know and need in almost every program... 
Maybe that's better than any documentation, at least for a quick start...  :)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 07, 2018, 09:12:20 am
And I heard that FPC already has a foundation or something. Does it mean it finally has some kind of financial support? If that so, I think they need to hire professional people to do these things:
1. Migrate all the codes to github so it's more visible to the outside world, including the code management tools (issues, etc).
2. Build a great and complete documentations.
3. Make a brand new website and forum that looks modern.
4. Plus make some marketing noises on the internet and social media.

Let the world knows that we have a new and modern Pascal.

The boss of foundation is the same person who is responsible for my ban : Michael Van Canneyt... IMO his approach of doing things is far away from "modern".

I will for sure run some new foundation (or some way of crowdfunding) for NewPascal in more professional way than current beer oriented donations : http://newpascal.org/about.html

btw. NewPascal got updated few hours ago ( http://newpascal.org/download.html / https://github.com/newpascal/newpascal/releases/tag/np-v1.0.55 ).
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Laksen on May 07, 2018, 11:35:35 am
This is the kind of stuff that should have been focused on a long time ago IMO, instead of stuff literally nobody cares about at all... (Seriously, what's with all the i8086 compiler target commits in the trunk recently? What a completely pointless waste of time.)

As has been said many times anything that goes on in fpc is made by volunteers in their own time and not steered by a project lead or any milestones

Adding a 8086 back-end does nothing but make the entire back-end pipeline more applicable to other new architectures without affecting anything else

So a win for just about everyone

Changing stuff in the front end on the other hand has a tendency to affect everyone so it has to be done really carefully so you can keep trusting fpc to be a high quality compiler
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 08, 2018, 03:36:21 am
As has been said many times anything that goes on in fpc is made by volunteers in their own time and not steered by a project lead or any milestones.
Indeed. However, leadership and management is still required though, it's a project after all. Leadership is required to maintain the vision of the project and management is required to keep the project on the track. That's why some other voluntary-based open source projects have some kind of a board like in a company. I think both FPC and Lazarus lack of true leadership and management, but more on seniorship and skill. If you've been with FPC long enough or you contribute lots of code to FPC, then you got some respects. It needs more than that to keep these huge projects go well with time and new people.

Changing stuff in the front end on the other hand has a tendency to affect everyone so it has to be done really carefully so you can keep trusting fpc to be a high quality compiler
A high quality compiler is not only talking about stability and performance, but also about features. Turbo Pascal is really a high quality compiler, technically speaking, but it's useless because it doesn't provide many features of modern programming.

There are 2 kind of ways of thinking in technology:
1. Backward compatible, is to keep new features always operatable on past or old technologies, no matter the cost including sacrificing new technologies.
2. Forward compatible, is to keep new features always ahead of past or old technologies, no matter the cost including sacrificing old technologies.

Each has its own dis/advantages. I think FPC is on the first one. I hope NewPascal to be on the second one. I personally prefer the second one. As Izak promised to work on NewPascal based on FPC's master repo, then we got the best of both world. I don't know if Izak would or could keep his promises, but it's good enough for me to switch to NewPascal once it goes public and stable.

@hnb:
FPC just released new "default namespace" feature. It's not actually a new feature in modern programming because many other languages had provided it long before Pascal. And it also had been requested many times since long time ago. But at least Pascal has it too now, finally. I hope it will go to NewPascal as well.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 08, 2018, 07:05:07 am
As has been said many times anything that goes on in fpc is made by volunteers in their own time and not steered by a project lead or any milestones.
Indeed. However, leadership and management is still required though, it's a project after all. Leadership is required to maintain the vision of the project and management is required to keep the project on the track. That's why some other voluntary-based open source projects have some kind of a board like in a company.

Like? Usually such structure only comes when donations or sponsors are high enough to actually have resources to direct.
 
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 08, 2018, 12:22:41 pm
I don't know if Izak would or could keep his promises, but it's good enough for me to switch to NewPascal once it goes public and stable.

I will do what I can best. NewPascal is already used for 24h servers and all works fine, every release is checked (full tests suite with FPC tests and mORMot). NewPascal is public - maybe not big page and effort for now but : Think Big, Start Small

btw. Izak is the surname ^^. The root of my surname is Isaksson.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Chronos on May 08, 2018, 01:06:16 pm
Like? Usually such structure only comes when donations or sponsors are high enough to actually have resources to direct.

But then we have here a chicken egg problem again. There are no donations and sponsors because project is not big enough and project is not evolved significantly because there are no money to pay developers. So the usual answer that the feature XYZ can be implemented because it is a volunteer project and there are no resources to do that is simply not good for most of us. You can't get donations and sponsors overnight. But there can be an active effort to get there once. And nobody would say that it is an easy task. But without it, FPC and Lazarus will be still the same small limited projects for many years to come.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Handoko on May 08, 2018, 01:33:19 pm
There are no donations and sponsors because project is not big enough and project is not evolved significantly ...

I personally think Lazarus and FPC are big enough to receive donations, the problem is in the efforts to attract donations.

For example in WordPress. They have a well-organized website, which all the plugins and themes will show the information about the plugin/theme like Ratings, Support, Reviews, etc, and most important the developer can have a donation link on that page. That useful info will make users more likely to donate some money. Not much, but I regularly donate some dollars to the plugins and themes I used.

See the example below:
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 08, 2018, 02:41:36 pm
Like? Usually such structure only comes when donations or sponsors are high enough to actually have resources to direct.

But then we have here a chicken egg problem again. There are no donations and sponsors because project is not big enough and project is not evolved significantly because there are no money to pay developers.

Maybe, but probably the area of the project is not popular enough to get to that size any which way.

Quote
So the usual answer that the feature XYZ can be implemented because it is a volunteer project and there are no resources to do that is simply not good for most of us. You can't get donations and sponsors overnight. But there can be an active effort to get there once. And nobody would say that it is an easy task. But without it, FPC and Lazarus will be still the same small limited projects for many years to come.

First, that still doesn't solve the governing problem, you can't assign volunteers, and not everybody can do all tasks.

Second,  all manpower that you theoretically could reassign will leaves holes elsewhere.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: valdir.marcos on May 08, 2018, 06:11:11 pm
Like? Usually such structure only comes when donations or sponsors are high enough to actually have resources to direct.

But then we have here a chicken egg problem again. There are no donations and sponsors because project is not big enough and project is not evolved significantly because there are no money to pay developers.

Maybe, but probably the area of the project is not popular enough to get to that size any which way.
Quote
So the usual answer that the feature XYZ can be implemented because it is a volunteer project and there are no resources to do that is simply not good for most of us. You can't get donations and sponsors overnight. But there can be an active effort to get there once. And nobody would say that it is an easy task. But without it, FPC and Lazarus will be still the same small limited projects for many years to come.

First, that still doesn't solve the governing problem, you can't assign volunteers, and not everybody can do all tasks.

Second,  all manpower that you theoretically could reassign will leaves holes elsewhere.

I am talking to some friends so we can get some money to sponsor some new people (younger than 30, maybe college students) to solve some old annoying small bugs or some old missing small features.
We won't get enough money to pay experienced old programmers and even if we made it, we would take them from other important tasks.
There won't be enough money to pay for big new features, so we have to think about solving small problems that disturb our daily routine.
If there is a little more money, we would think of servers and knowhow for Continuous Integration (CI) for both FPC and Lazarus. This solution would became an actual example for everybody.
Maybe something similar to:
https://www.firebirdsql.org/en/snapshot-builds/
https://www.firebirdsql.org/en/server-packages/
https://www.firebirdsql.org/en/development/
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 08, 2018, 07:37:50 pm
https://www.firebirdsql.org/en/snapshot-builds/

ftp://ftp.freepascal.org/pub/fpc/snapshot/v31/

Quote
https://www.firebirdsql.org/en/server-packages/

Seems to be regular release. We have that.

ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/

Quote
https://www.firebirdsql.org/en/development/

https://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi

Any help increasing coverage and frequency welcome, but it is all basically there.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 08, 2018, 09:13:13 pm
I am talking to some friends so we can get some money to sponsor some new people (younger than 30, maybe college students) to solve some old annoying small bugs or some old missing small features.
...
If there is a little more money, we would think of servers and knowhow for Continuous Integration (CI) for both FPC and Lazarus. This solution would became an actual example for everybody.

the current situation is ridiculous. All of mentioned : old bugs, small bugs, small missing features (+ the bigger one) was the subject of my work (and I am younger than 30). I am also author of working CI systems for builds and tests for FPC and Lazarus. And now in the consequence of revenge I am outside core team. How FPC wants to attract new persons if Michael feels that he owns the whole project and starts acting as headmasters?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 08, 2018, 09:46:51 pm
Maciej, stop it. Work it out. These kind of comments aren't very helpful.
You know I respect and test your contributions.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 08, 2018, 11:06:00 pm
Maciej, stop it. Work it out. These kind of comments aren't very helpful.
You know I respect and test your contributions.
I am opened to continue my work for community, not for Michael but I have ban from Michael which is also boss of FPC foundation. How can I contribute bug fixes for compiler, updates for my libraries without access to trunk and core mailing list?

I am really forced to continue NewPascal way. For sure we need new more open minded foundation with place for everyone (Michael is also welcome).

This is all Thaddy, I am not angry anymore I just want to work on modern Pascal in friendly atmosphere.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Blaazen on May 08, 2018, 11:17:20 pm
Hi,

on ML you mentioned: "I have ban for FPC core mailing list (no more "Daily test suite diffs" for me)".

What are "Daily test suite diffs"?

Thanks
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: HeavyUser on May 09, 2018, 01:19:28 am
Maciej, stop it. Work it out. These kind of comments aren't very helpful.
You know I respect and test your contributions.
I am opened to continue my work for community, not for Michael but I have ban from Michael which is also boss of FPC foundation. How can I contribute bug fixes for compiler, updates for my libraries without access to trunk and core mailing list?
use the bugtracker, attach the diff of the files to a bug report and walk away, if you really want to do. If not then as long as your repo is online and accessible by the team then they can pull what ever they need.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 09, 2018, 03:03:42 am
on ML you mentioned: "I have ban for FPC core mailing list (no more "Daily test suite diffs" for me)".

What are "Daily test suite diffs"?

It summarizes the differences in the nightly testsuite runs on https://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi

Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 09, 2018, 04:49:32 am
On one side, everybody agrees that both FPC and Lazarus need more and more volunteers, especially from younger generation to ensure these great projects will have a bright future. But on the other side, sometimes new people aren't very welcome to contribute if this new people doesn't conform to the seniors way of thinking. This Maciej's case is the latest example, but I've seen similar cases since I joined FPC/Lazarus.

On one side, everybody knows that we need to get popular so this project could attract both volunteers and fundings, especially from younger generation. But on the other side, I don't see much effort has been done to overcome this problem. The core devs barely think about it, because they mostly think about the technical things. I don't blame them because it's their focus and concern, but if nobody would tackle and handle these non-technical problems, then we'll getting nowhere. We'll be forever a niché in software development. Nobody cares about Pascal but a bunch of old people who still maintaining their projects in their niché market.

Now I think I understand why CodeTyphon chose its way. Rather than contributing directly to the project, Sternas (CT's author) simply took the project with him and do it his way so he didn't need to bother with core devs approvals and agreements. Although he did some nasty things with the licenses, but look… FPC/Laz devs don't mind, even support him. So, I think Maciej's decision to work on his own FPC fork is correct. As long as he keeps following FPC development and base his work on it, I'll support him.

Maybe it's time for FPC and Lazarus to have a new "competitor" other than Delphi so they will start to be more open minded accepting new ideas from new people. If Maciej keeps continuing his work and regularly release stable New Pascal with new features that offers something more than the orginal FPC, I'm sure New Pascal would have its own users and fans. Just like CodeTyphon.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: engkin on May 09, 2018, 06:41:50 am
Now I think I understand why CodeTyphon chose its way. Rather than contributing directly to the project, Sternas (CT's author) simply took the project with him and do it his way so he didn't need to bother with core devs approvals and agreements.
I think this conclusion is not accurate.

Although he did some nasty things with the licenses, but look… FPC/Laz devs don't mind, even support him.
Are you sure they don't mind? Who supports him?

So, I think Maciej's decision to work on his own FPC fork is correct. As long as he keeps following FPC development and base his work on it, I'll support him.
Sincere question: Why do you want him to base his work on the work of "a bunch of old people"?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 09:20:45 am
use the bugtracker, attach the diff of the files to a bug report and walk away, if you really want to do. If not then as long as your repo is online and accessible by the team then they can pull what ever they need.

I was thinking about using FPC bugtracker as normal user (this is how was looking my work before). What I can say : In many cases filling bug report, preparing *.patch takes more time than fix and commit to trunk. Redundant work (especially for minor fixes). Someone needs to assign bug report, apply the patch and commit (some patches waits few years !sic so filling bug reports for sport is not practical). Because of someone's "strange" decision we need to waste many of the important time. Doing this in current situation is also demotivating. Probably I should continue detailed list of changes like :

http://newpascal.org/compass.html

but without bugreports in FPC mantis.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 09:21:57 am
Sincere question: Why do you want him to base his work on the work of "a bunch of old people"?

Free bug fixes for NewPascal!
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 09, 2018, 10:10:44 am
I was thinking about using FPC bugtracker as normal user (this is how was looking my work before). What I can say : In many cases filling bug report, preparing *.patch takes more time than fix and commit to trunk. Redundant work (especially for minor fixes). Someone needs to assign bug report, apply the patch and commit (some patches waits few years !sic so filling bug reports for sport is not practical). Because of someone's "strange" decision we need to waste many of the important time. Doing this in current situation is also demotivating. Probably I should continue detailed list of changes like :

For major work and restructures, yes this can take some while. For short patches it is significantly quicker.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: valdir.marcos on May 09, 2018, 10:14:16 am
https://www.firebirdsql.org/en/snapshot-builds/
ftp://ftp.freepascal.org/pub/fpc/snapshot/v31/

Quote
https://www.firebirdsql.org/en/server-packages/
Seems to be regular release. We have that.
ftp://ftp.freepascal.org/pub/fpc/dist/3.0.4/

Quote
https://www.firebirdsql.org/en/development/
https://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi
Any help increasing coverage and frequency welcome, but it is all basically there.


I was thinking of solutions similar to:
https://jenkins.io/
https://travis-ci.org/
https://www.gocd.org/

To easy and improve environments such as:
Whenever I need to compile a new version of my cross platform tools, I do it like this :

Copy code to OSX system. Compile and build.
Copy code to Windows virtual machine. Compile and build.
Copy code to Linux 32-bit distribution virtual machine. Compile and build.
Copy code to Linux 64-bit distribution virtual machine. Compile and build.

Upload binaries, executable and OSX app file to web server. 

As you might imagine, that is a bit of a faff!! And can be frustrating, especially if you get to the end of even half way through and realise I've forgot to update a form caption or something and so have to repeat it all!

Someone mentioned that if code is on GitHub, the build process can be automated for all three systems using continuous integration.
....
I realize in the project settings you can change the target CPU and so on, but I've never yet successfully managed to create, for example, a Linux binary on a Windows system. So I've always just done it as stated in the steps above.

Any guidance welcome.

For example if I want to get automatic development builds of a program made with lazarus with one of the CI tools available online (appveyor). There's a tutorial on how to do it?

It for example needs some packages installed in the IDE to work.

I'm intrigued since I recently seen an appveyor file in New Pascal.

And if is not possible don't mind. Is a specific question, I know I can automate that in my machine too, but I'm asking about online services.

I've been working on an fpcunit listener that writes fpcunit test results to a database instead of an XML file: handy to be able to compare results between runs and detect regressions.

My aim was to make the code cross-database friendly (using portable SQL) and normalize the database so it can be used for a lot of test results (e.g. in Continuous Integration server kicked off by SVN commits).

I've been using it with a remote Firebird database server in my Jenkins CI server for the dbtestframework tests (see http://wiki.lazarus.freepascal.org/Jenkins#FPCUnit.2FDBTestframework_tests_with_database_output (http://wiki.lazarus.freepascal.org/Jenkins#FPCUnit.2FDBTestframework_tests_with_database_output))

By now, I think I've got the test listener code working well from a functional perspective and I'm now looking at improving performance without sacrificing storage size/normalization.

This hypothetical wiki documented best solution for FPC and Lazarus servers would fit and help greatly many of us.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Pascal on May 09, 2018, 10:31:05 am
Maybe we can use Docker to setup a CI-System as starting point for own projects.
I've thought of building my own a few times already but in fact didn't start so far.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 09, 2018, 10:41:00 am
I was thinking of solutions similar to:
https://jenkins.io/
https://travis-ci.org/
https://www.gocd.org/

To easy and improve environments such as:

Ok, so for development of applications WITH Lazarus and FPC, not development ON lazarus and fpc.

Lazarus ran Jenkins for a while, iirc  if after a commit there was no new commit in 5 minutes or so.

Personally, I think it is more stuff for teams than for single developers. Getting deep into these systems also takes time, and for one machine administered by one person a few simple scripts are easier. At least IMHO.

Of course it probably it is less of a problem if you already use some of the techniques, but I don't maintain any LAMP or alternatives (webservers, web serverside scripting languages, and I haven't touched Java seriously in a decade), both experience or maintenance, so for me that would be all extra burdens just to use one of these packages and or develop plugins for them.

Afaik Lacak who does a lot of SQLDB work, has an own testsuite.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: valdir.marcos on May 09, 2018, 10:44:09 am
On one side, everybody agrees that both FPC and Lazarus need more and more volunteers, especially from younger generation to ensure these great projects will have a bright future. But on the other side, sometimes new people aren't very welcome to contribute if this new people doesn't conform to the seniors way of thinking. This Maciej's case is the latest example, but I've seen similar cases since I joined FPC/Lazarus.
+1

Quote
On one side, everybody knows that we need to get popular so this project could attract both volunteers and fundings, especially from younger generation. But on the other side, I don't see much effort has been done to overcome this problem. The core devs barely think about it, because they mostly think about the technical things. I don't blame them because it's their focus and concern, but if nobody would tackle and handle these non-technical problems, then we'll getting nowhere. We'll be forever a niché in software development. Nobody cares about Pascal but a bunch of old people who still maintaining their projects in their niché market.
+1

Quote
Now I think I understand why CodeTyphon chose its way. Rather than contributing directly to the project, Sternas (CT's author) simply took the project with him and do it his way so he didn't need to bother with core devs approvals and agreements. Although he did some nasty things with the licenses, but look… FPC/Laz devs don't mind, even support him. So, I think Maciej's decision to work on his own FPC fork is correct. As long as he keeps following FPC development and base his work on it, I'll support him.
So far, I have never used CT, but reading discussions on this forum, it seems that CT's author motivations were more economical than philosophical.

Quote
Maybe it's time for FPC and Lazarus to have a new "competitor" other than Delphi
I know that my opinion is not relevant here since I am neither a core developer nor a patcher, but I still think that work together is better than forking in the open source world.

Quote
Maybe it's time for FPC and Lazarus to have a new "competitor" other than Delphi so they will start to be more open minded accepting new ideas from new people.
Considering recent examples such as PHP x Hack (HHVM), PHP evolved very fast after Facebook competition had created Hack based on PHP.

Quote
If Maciej keeps continuing his work and regularly release stable New Pascal with new features that offers something more than the orginal FPC, I'm sure New Pascal would have its own users and fans. Just like CodeTyphon.
Unfortunately, you are probably right.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 10:45:47 am
For major work and restructures, yes this can take some while. For short patches it is significantly quicker.
For short patches generally it works in this way, but this is not the rule. If no one from core is interested, the patch can wait long time (even short patch). If I have ban for trunk without rational reason, I think that my patch can be rejected also without rational reason also my bug report can be simple ignored with malice (what I'm afraid of). The general fact about redundant work from my side is still valid. Could you explain me the sense of redundant work? Why I am forced to fill bug report for every minor thing instead of working on more fixes?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: valdir.marcos on May 09, 2018, 10:54:33 am
I was thinking of solutions similar to:
https://jenkins.io/
https://travis-ci.org/
https://www.gocd.org/

To easy and improve environments such as:

Ok, so for development of applications WITH Lazarus and FPC, not development ON lazarus and fpc.

Lazarus ran Jenkins for a while, iirc  if after a commit there was no new commit in 5 minutes or so.

Personally, I think it is more stuff for teams than for single developers. Getting deep into these systems also takes time, and for one machine administered by one person a few simple scripts are easier. At least IMHO.

Of course it probably it is less of a problem if you already use some of the techniques, but I don't maintain any LAMP or alternatives (webservers, web serverside scripting languages, and I haven't touched Java seriously in a decade), both experience or maintenance, so for me that would be all extra burdens just to use one of these packages and or develop plugins for them.

Afaik Lacak who does a lot of SQLDB work, has an own testsuite.
I understand and respect you point of view.
The solution I was talking about was meant for teams, from small through big ones.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 11:03:41 am
I was thinking of solutions similar to:
https://jenkins.io/
https://travis-ci.org/
https://www.gocd.org/

the part of work is ready in NewPascal and in my personal repositories. The tests and fresh releases are uploaded automatically.

The Michael said that CI is almost impossible to fully integration with FPC. IIRC he said that CI can't be used for generation of documentation and he need to do some things manually. If I am wrong please someone to correct me. In my opinion such thing should be also possible with CI, but maybe there is some problem which I am not aware of (I didn't trying to use CI for FPC documentation).
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Pascal on May 09, 2018, 11:11:21 am
The Michael said that CI is almost impossible to fully integration with FPC. IIRC he said that CI can't be used for generation of documentation and he need to do some things manually. If I am wrong please someone to correct me. In my opinion such thing should be also possible with CI, but maybe there is some problem which I am not aware of (I didn't trying to use CI for FPC documentation).

Why not? Technically speaking CI servers just run scripts!
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 11:17:52 am
Why not? Technically speaking CI servers just run scripts!

I said similar thing but Michael was in opposition to the idea, he allows me to doing this but was not much optimistic. You should ask Michael, I have no idea why this is impossible (or so hard). I will say it again : I was not trying this yet, so maybe there is some problem.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: x2nie on May 09, 2018, 11:42:29 am
wait, gurus....


This discussion has given me a bigbang headache because I couldn't catch what really we are talking about.
Before going more further, so please,
1. what is "NewPascal" meaning?  (I visit the link and found nothing about technical advantage upon fpc)
Is it a brand new pascal dialect compiler (like PicPas doing) ?
2. What is the "modern" things which NewPascal provides?
3. In which situation NewPascal will beat better than fpc/trunk can do?

What I understood is: Mormot will deadly depend on NewPascal, but I don't know the detail reason.
 :-*
---correct me if I wrong
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 09, 2018, 11:50:31 am
wait, gurus....


This discussion has given me a bigbang headache because I couldn't catch what really we are talking about.
Before going more further, so please,
1. what is "NewPascal" meaning?  (I visit the link and found nothing about technical advantage upon fpc)
Is it a brand new pascal dialect compiler (like PicPas doing) ?
It is a fork. With a focus on Delphi syntax (which is good imho)
Quote
2. What is the "modern" things which NewPascal provides?
Not many, yet. If any at the moment.
Quote
3. In which situation NewPascal will beat better than fpc/trunk can do?

What I understood is: Mormot will deadly depend on NewPascal, but I don't know the detail reason.
 :-*
---correct me if I wrong
Possibly - but I did not see any real evidence yet - quicker -riskier? -implementation of some more Delphi compatible features, like ARC, anonymous methods (compiler) and extended generics (very good implementation, but also in fpc trunk). None of these are in NewPascal yet, as I understand. (Correct me if I am wrong Maciej)
IMO High risk without the core team. I test it now and then but do not use it. Maciej is a very talented developer, but the ONLY developer for NewPascal's compiler.
I also want a thorough code review to test clean-room. That is not to be critical in any way but to make sure. Do not read any suggestion in that remark.

Thing I most like is default properties for non-array types. (Related to ARC and smart pointers)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 09, 2018, 12:12:40 pm
1. what is "NewPascal" meaning?  (I visit the link and found nothing about technical advantage upon fpc)
Is it a brand new pascal dialect compiler (like PicPas doing) ?
2. What is the "modern" things which NewPascal provides?
3. In which situation NewPascal will beat better than fpc/trunk can do?

What I understood is: Mormot will deadly depend on NewPascal, but I don't know the detail reason.

NewPascal means New(Pascal) ^^. NewPascal sooner or later will be also new mode/dialect for compiler.

When I was part of FPC core almost all stuff was successful ported to FPC trunk including new features, bug fixes and improvements, generally all was merged except "default field" functionality which is used for SmartPointers, ARC objects and Nullable types.

So for now the main/general difference between trunk and NewPascal is Smart Pointers functionality: https://github.com/maciej-izak/PascalSmartPointers

My ban is fresh so there is not much new patches in NewPascal yet, finally I was part of FPC core team and NewPascal was almost fully integrated with FPC core.

With NewPascal you will get all what you have with trunk, but with many additions :
- Ready to use pre-compiled trunk (trunk version for NewPascal is selected to provide as stable trunk as possible without regressions)
- Patches
- New modern features

NewPascal will be better in the situations:
- When you use Generics.Collections library (I am main author so for sure NewPascal version is more actual and more bug free)
- When you use mORMot. Advantage of NewPascal is close cooperation with mORMot, so every change in critical parts of NewPascal (RTL, low level details) are handled in mORMot immediately. FPC trunk is also supported but in some situations update for mORMot may be delayed (and mix of FPC trunk and mORMot may be nonfunctional/full of bugs for some time). mORMot will be compatible with pure trunk, why not? mORMot is freedom of choice.
- When you like to use modern Pascal with more Oxygene like syntax.
- When you like to have faster code - you don't need to use modern syntax, you can still be compatible with FPC trunk but I have ready very important patches for compiler to speed up all code where managed types are used (strings, dynamic arrays, interfaces etc.). The difference with extensive usage of managed types between NewPascal and trunk can be really huge.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 09, 2018, 12:19:01 pm
On one side, everybody agrees that both FPC and Lazarus need more and more volunteers, especially from younger generation to ensure these great projects will have a bright future. But on the other side, sometimes new people aren't very welcome to contribute if this new people doesn't conform to the seniors way of thinking.

Or if they have problems cooperating and functioning in a team with people with different priorities etc. Posting mails like this (http://lists.freepascal.org/pipermail/fpc-devel/2018-May/038886.html) doesn't help, and I understand there was also some friction in personal mails between Michael and Maciej.

Nobody is happy on how this went down, but the common view on this is simply wrong. Note that when Maciej became committer, there were already some reservations about temper and cooperation with part of core, but due to huge work done, it was given the benefit of the doubt.

However the comparisons with other cases in this thread is systematically wrong, and is usually based on exit mails of frustrated people that had cooperation difficulties, and threw a tantrum when they didn't get their way soon enough, or when core didn't drop everything they were doing and rallied around their opinion. Most never got as far as Maciej did. Often they did even get as far as Maciej before he made core even.

In this case it is fairly unique.

Quote
This Maciej's case is the latest example, but I've seen similar cases since I joined FPC/Lazarus.

Maciej's case is different, because he made committer and actually functioned quite alright for quite a while. People usually grow significantly when they do that, also in cooperation perspective. The only somewhat similar case is Almindor aka Ales Katona in the 2005-2008 timeframe.

He was terribly noisy and radical as early user and bugreporter, but as he grew older and made core he adapted. Parts of fcl-web and LNet are still his. His exit however was more related to changes in his personal life (graduation and marriage). Lnet became only part of FPC after he left.

Quote
On one side, everybody knows that we need to get popular so this project could attract both volunteers and fundings, especially from younger generation.

It wouldn't hurt, certainly.

Quote
But on the other side, I don't see much effort has been done to overcome this problem.

The problem is that most people wait for commitment from an overworked core or some revolution and then throw a tantrum when it doesn't happen. Things take time, and significant commitment and persistent.

The list is numerous fcl-web, fcl-db (multiple people actually Sebastian Michael Joost Lacak), fpreport half of packages is from people that came and wanted to add but did cooperate.

Maciej also belongs to that list because rtl-generics is there, nevermind what happened after or what will happen in the future. And that is just FPC, there are also his contributions to Lazarus

Quote
The core devs barely think about it, because they mostly think about the technical things.

They have seen 50 such initiatives stumble because the people starting it burned out. They all start too hot and expect change and uptake on a too short timescale and get frustrated. Paradoxically some of those effort succeed later building on those initially failed initiatives. Sometimes by the same person, older and wiser, sometimes by somebody else, and sometimes because it slowly evaluates to become mature enough to be maintained by core and patch submitters.

Quote
I don't blame them because it's their focus and concern, but if nobody would tackle and handle these non-technical problems, then we'll getting nowhere.

Plans are not the problem. The manpower to do them is. And the radicals usually burn out before their goals are met. Even partially.

Quote
We'll be forever a niché in software development. Nobody cares about Pascal but a bunch of old people who still maintaining their projects in their niché market.

It is possible that remains the case. Most languages are pushed by giga large enterprises. Even with sometimes-paid committers you might not be able to duplicate that.

I think it is better to focus on some uses where strengths lie, than to spread the resources too thin trying to duplicate things in popular fields where you never be considered an equal anyway. Or at least find a clear different angle than just "Pascal".

Quote
Now I think I understand why CodeTyphon chose its way. Rather than contributing directly to the project, Sternas (CT's author) simply took the project with him and do it his way so he didn't need to bother with core devs approvals and agreements.

Sternas had never any serious relation or cooperation with core. The project grew from a distro within his company where he combined development versions with his own patched Delphi packages. He had some very doubtful practices like renaming all files, removing or editing copyright messages and not keeping the originals, that made usage of those packages within FPC or Lazarus impossible. There were some attempts to reason with him, but he was unwilling to improve his ways, and that was about it. It was never on any serious level.

Afaik the people working on the lazarus packages repository actually go back to the original packages and merge in CT fixes if necessary, but don't base themselves on CT originals.

Quote
Although he did some nasty things with the licenses, but look… FPC/Laz devs don't mind, even support him.

Not that I know. Most work is duplicate effort which could have been avoided if Sternas had cleaned up his act.

Quote
So, I think Maciej's decision to work on his own FPC fork is correct. As long as he keeps following FPC development and base his work on it, I'll support him.

I think it is unfair to compare Maciej with Sternas. Before he made core, Maciej was already accountable, and during core he improved how he delivered his changes.  Also I see CT more as a distribution with a external packages than a fork. The real work is fairly thin. Newpascal had original new work from the beginning.

A fork is always bad, if only due to the synchronization, but maybe the impact is not too bad long term.

Short term, the impact is horrible. Somewhere in the coming 6-9 months a new major branch must be made for stabilization, and some things could have made it which now won't. This is horrible.

Quote
Maybe it's time for FPC and Lazarus to have a new "competitor" other than Delphi so they will start to be more open minded accepting new ideas from new people.

We were, and accepted Maciej as core as a result of it.

Quote
If Maciej keeps continuing his work and regularly release stable New Pascal with new features that offers something more than the orginal FPC, I'm sure New Pascal would have its own users and fans. Just like CodeTyphon.

For now I consider it a testbed and development snapshot for Mormot, some of which will remain "unstable" for a long term, see above.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 09, 2018, 12:38:11 pm
Marco,

Well written.

Tnx.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: ASBzone on May 09, 2018, 02:47:16 pm
Marco,

Well written.

Tnx.

I agree.   :D    And I appreciated the background, too.

I am relatively new to this technical community, but not to technical communities in general.    From the little that I have observed, this community has some seriously skilled persons, and there are almost assuredly going to be personality conflicts in such a gathering.

As the saying goes, "This too shall pass."

Regardless of how everyone feels right now, I would strongly advise the principal players to avoid any unnecessary and potentially hurtful comments -- especially in the short-term.  These things often blow over in time, and as everyone matures or expands their perspectives (I'm not suggesting immaturity on anyone's part -- just referencing how life works), the opportunity to revisit this issue from a different angle might manifest itself.  This is far less likely to occur if the next few days and weeks are spent with recriminations and counterpoints that get posted to the eternal web.

If moving apart and working separately is a good course for now, it will be best done quietly, as there is less ego to retract or subdue later. 

I thank the parties who are trying to get things to cool down, and I appeal to those in the thick of things to move forward cautiously.   I'm not here to take sides, and thankfully I'm new enough that the lack of bias should be obvious (despite Maciej helping me out just yesterday).

I hope it all works out, for everyone involved, regardless of which direction things go from here, and that the Object Pascal community is enriched by it.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 10, 2018, 11:38:26 am
NewPascal means New(Pascal) ^^. NewPascal sooner or later will be also new mode/dialect for compiler.
I don't need much. I just need my crazy Delphi code to compile.
Code: Pascal  [Select][+][-]
  1.     ATestCase.AddTestCase(
  2.       'Slice test',
  3.       True,
  4.       function(var ASource:TAbstractPairList<TTestObject, String>):TAbstractPairList<TTestObject, String>
  5.         var Keys:TAbstractList<TTestObject>;
  6.       begin
  7.         CreateKeyObjectKeyRange(ASource).AssignInit(Keys);
  8.         Result := KeyObjectPairListFromKeyList(
  9.           Keys.Slice(1, -2, 2)
  10.         );
  11.         Keys.Detach;
  12.       end,
  13.       ArrayOfKeyObjectPair(
  14.         [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
  15.         ['j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a']
  16.       ),
  17.       ArrayOfKeyObjectPair(
  18.         [3, 5, 7],
  19.         ['', '', '']
  20.       )
  21.     );
  22.  
What I want to add, is that it's actually dream of every programmer - to add features directly to compiler in order to make code more simply. I would personally add some meta-programming features to compiler in order to remove some routine code from my projects, that could be automated by compiler, so there would be much less room for errors. Some sort of advanced operator overloading. And also some multiple inheritance improvements, such as "subclass" feature or something. And it's core paradigm of Open Source: if you want something - do it yourself. And I've even tried, cuz I've got tired of 10 years of waiting for Delphi 2009 support. But... I guess, it's too much for me. FPC code has relatively low quality. I mean, it's hard to understand it's structure and there are no docs or good comments. Yeah, here is parser, here are nodes, here is code generator, here is assembler, but... I see whole picture, but it's not enough - I need details. And there is no place, I can get them from.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 10, 2018, 12:33:32 pm
For major work and restructures, yes this can take some while. For short patches it is significantly quicker.
For short patches generally it works in this way, but this is not the rule. If no one from core is interested, the patch can wait long time (even short patch).

Yes, all possible.

Quote
If I have ban for trunk without rational reason, I think that my patch can be rejected also without rational reason also my bug report can be simple ignored with malice (what I'm afraid of).

... but don't get paranoid.

Quote
The general fact about redundant work from my side is still valid. Could you explain me the sense of redundant work? Why I am forced to fill bug report for every minor thing instead of working on more fixes?

Spite is not sensible either. If you have minor patches to stuff already in trunk, please commit them.

Let's all cool down, and get some work done.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 10, 2018, 12:40:51 pm
The Michael said that CI is almost impossible to fully integration with FPC. IIRC he said that CI can't be used for generation of documentation and he need to do some things manually. If I am wrong please someone to correct me.

Maybe. But those would probably be fairly minimal, and maybe solutions could be found. And even if it were insurmontable, one could leave the docs out of the daily CI, and only run it once every two weeks controlled.

Lazarus documentation is more often than not in a non-compilable state. They require a new file xml to be generated and checked in for every new source file, and the procedure breaks on that. Last try is in 3.0.4 building times.

Another issue is that fpdoc uses fcl-passrc which evolves extremely fast due to pas2js. The CHM generation has problems because of it.

Quote
In my opinion such thing should be also possible with CI, but maybe there is some problem which I am not aware of (I didn't trying to use CI for FPC documentation).

I think it would be possible, but might require work and careful following up a period of a couple of months. Docs never has had much work done outside release periods.  We all do minor spelling fixes, but usually Michael documents new units during a release cycle.

I do have doubts about releasing the CI results though. (iow having daily or even per commit completely built releases)

So it would be tests only, and anything outside the core "fpc" repo mutates so slowly it is a terrible waste of cycles and space IMHO. Let the poor polar bear live!

Trigger full release building every two weeks

But having a jenkins or something else compilng the FPC main repo again would be good. Lazarus ran it for a while with results to the irc channel and that was nice.

For the FPC project I do favor own build tools over complex external packages though. Simply because work in the language that binds us in the project can be done by more people than in an external language.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 10, 2018, 01:57:47 pm
I don't need much. I just need my crazy Delphi code to compile.

This should happens soon with NewPascal and maybe with FPC too. :)

What I want to add, is that it's actually dream of every programmer - to add features directly to compiler in order to make code more simply. I would personally add some meta-programming features to compiler in order to remove some routine code from my projects, that could be automated by compiler, so there would be much less room for errors. Some sort of advanced operator overloading. And also some multiple inheritance improvements, such as "subclass" feature or something.

I fully understand this and this is for sure subject of my work. The idea of non existing yet "NewPascal" dialect is strong support for meta programming in very clean "Pascal" way with full assistance of existing dialects and well known RTL. The tools like YACC or boost:spirit library should be replaceable by NewPascal dialect in long term future.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 10, 2018, 02:00:55 pm
Spite is not sensible either. If you have minor patches to stuff already in trunk, please commit them.

Let's all cool down, and get some work done.

Thanks for professional approach. So do I have full svn access again? I always plays with rules : in trunk you will not find any commit for critical parts of compiler nor for RTL which was not consulted with Sven, Florian, Michael (!) or Jonas (in this context Michael e-mail was real shock for me). There was some small patches for critical parts but only when I was 100% sure that the patch is correct and tested (which was also approved by Florian - so the rules were followed all the time).

For less frustration for both sides would be good to keeps both projects alive. I can continue NewPascal with my ideas and vision but at the same time I see no reason why FPC should not benefit from my work in less "neuralgic" code parts. If the core will change opinions about new features from NewPascal any of feature can be merged back into FPC trunk. IMO this path is beneficial for all. In the worst scenario I will "burn out" (which is not planned by me) but in general FPC will be better.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 10, 2018, 02:43:57 pm
I fully understand this and this is for sure subject of my work. The idea of non existing yet "NewPascal" dialect is strong support for meta programming in very clean "Pascal" way with full assistance of existing dialects and well known RTL. The tools like YACC or boost:spirit library should be replaceable by NewPascal dialect in long term future.
I just hate, when code becomes overcomplicated due to compiler limitations. For example multiple inheritance problem. Standard situation:
Code: Pascal  [Select][+][-]
  1. type
  2.   TAbstactClass1 = class
  3.   ...
  4.   end;
  5.  
  6.   TImplementation1 = class(TAbstractClass1)
  7.   ...
  8.   end;
  9.  
  10. //But then
  11.  
  12.   TAbstractClass2 = class(TAbstractClass1)
  13.   end;
  14.  
  15. //Bad thing - I can't reuse TImplementation1 code here.
  16. //I have to copy-paste everything. This increases sizes of both sources and code itself,
  17. //overcomplicates and increases chance of errors.
  18.  
  19.   TImplementation2 = class(TAbstractClass2)
  20.   end;
  21.  
  22. //And possible solution is very ugly, slow and memory inefficient
  23. //But I have to deal with it
  24.  

And I also need some meta-programming features to automate some code. I even have idea of MetaPascal™©® compiler, where compiler itself would be built fully via meta-programming tech, i.e. adding new features wouldn't require compiler modification - it would work like adding new units to your project. That's my dream.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 11, 2018, 10:23:06 am
I just hate, when code becomes overcomplicated due to compiler limitations. For example multiple inheritance problem. Standard situation:

This is controversy topic. But some kind of multiple inheritance should be possible with some extensions for "default field". But this is field of research, and for sure eventually "multiple inheritance" will be solved in other way than in C++. This is very dangerous play and is very easy to hurt language.

And I also need some meta-programming features to automate some code. I even have idea of MetaPascal™©® compiler, where compiler itself would be built fully via meta-programming tech, i.e. adding new features wouldn't require compiler modification - it would work like adding new units to your project. That's my dream.

This is my dream too :). Anyway the fast revolution is not possible. Rather evolution with start with new NewPascal dialect (which will initially get what is the best from delphi mode and objfpc + some new more oxygene like features).
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: tverweij on May 11, 2018, 11:23:02 am
I don't think a fork is a good think - it depletes the resources on both.
But I also don't think that an opensource project should ban contributors, because that has the same effect.

About the commits in minor areas: this is a problem I see in all open source projects; the developers do what they want because they are volunteers, so nobody can tell them what to do. But I see the same in payed projects (b.e Microsoft); the developers have to do what the management wants.
In both cases the work that the users want isn't done; as stated in earlier posts: if you want something done, you have to do it yourself. But not every programmer has the skills to do that, making them dependent on the ones that can - hoping that anyone will fix their problems / add the syntax sugar or functionality they need.

An opensource project works on donations. But why donate when the things you want aren't done? Why donate if you have no saying at all in the priorities?
Therefore some suggestions:
1. Don't ban code contributors
2. Make a request list where anyone can add their wishes (needed fixes, needed syntax sugar, needed functionality)
3. Give donators votes to vote on this request list (the more you donate, the more votes you get)
4. Pay a fee (from the donations) to the developers to do the work on the most requested items

Just my 2 cents.



Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Handoko on May 11, 2018, 11:32:38 am
I agree with most of the things you said.

For your information, Lazarus/FPC has a wishlist page:
http://wiki.freepascal.org/Feature_Ideas

Unfortunately not much users know that page exists.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: guest58172 on May 11, 2018, 11:54:08 am
This is my dream too :). Anyway the fast revolution is not possible. Rather evolution with start with new NewPascal dialect (which will initially get what is the best from delphi mode and objfpc + some new more oxygene like features).

I experienced the joy of metaprog in D and rich of this experience i can say that it's clear that's it's not possible in FPC. This requires multi-pass semantic, templates, and the most important, compile-time reflection. Object Pascal RTTI is an old but well working feature (used for the LCL GUI serialization for example ;) ) but it's not at all adapted to metaprog.
Too much changes to the compiler and language. Maybe a kind of pre-processor could work, to some extent.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 11, 2018, 12:39:26 pm
This is controversy topic. But some kind of multiple inheritance should be possible with some extensions for "default field". But this is field of research, and for sure eventually "multiple inheritance" will be solved in other way than in C++. This is very dangerous play and is very easy to hurt language.
Limited version of multiple inheritance is possible now - via interfaces. And interfaces are actually implemented the same way, as multiple inheritance in C++ - via wrappers, that add some delta to Self reference. So, performance wouldn't be hurt, if we would switch from interfaces to multiple inheritance. And... Using interfaces feels like a crutch programming. They have several drawbacks - no fields, mandatory reference counting, explicit casting via using GUID, etc. And, dunno about FPC, haven't tested it yet, but in Delphi I can't even implement base interface and it's descendants in the same class - I have to use aggregated interfaces and this is as bad, as just using "driver" model.

This doesn't work for me:
Code: Pascal  [Select][+][-]
  1. type
  2.   IBaseInterface = interface
  3.   ...
  4.     procedure DoSomething;
  5.   end;
  6.   IBaseInterfaceAlias1 = interface(IBaseInterface);
  7.   IBaseInterfaceAlias2 = interface(IBaseInterface);
  8.  
  9.   TImplementation = class(TInterfacedObject, IBaseInterface, IBaseInterfaceAlias1, IBaseInterfaceAlias2)
  10.     procedure BaseDoSomething;
  11.     procedure Alias1DoSomething;
  12.     procedure Alias2DoSomething;
  13.     procedure IBaseInterface.DoSomething = BaseDoSomething;
  14.     procedure IBaseInterfaceAlias1.DoSomething = Alias1DoSomething;
  15.     procedure IBaseInterfaceAlias2.DoSomething = Alias2DoSomething;
  16.   end;
  17.  
There is another possible method. I dunno, what is right name for it - I call it "driver method". It's similar to aggregated interfaces.
Code: Pascal  [Select][+][-]
  1. type
  2.   TAbstractClass1 = class
  3.   ...
  4.     procedure DoSomething;virtual;abstract;
  5.   ...
  6.   end;
  7.  
  8.   TImplementation1 = class(TAbstractClass1)
  9.   ...
  10.     procedure DoSomething;override;
  11.   ...
  12.   end;
  13.  
  14.   TAbstractClass2 = class(TAbstractClass1)
  15.   ...
  16.   end;
  17.  
  18.   TImplementation2 = class(TAbstractClass2)
  19.   ...
  20.      FClass1Implementation:TAbstractClass1;
  21.   ...
  22.      constructor Create;
  23.      procedure DoSomething;override;
  24.   end;  
  25.  
  26. //Create TAbstractClass1 "driver"
  27.  
  28. constructor TImplementation2.Create;
  29. begin
  30.   inherited Create;
  31.   FClass1Implementation := TImplementation1.Create;
  32. end;
  33.  
  34. //Wrapper procedure - of course it means source size, code size and performance penalty
  35.  
  36. procedure TImplementation2.DoSomething;
  37. begin
  38.   FClass1Implementation.DoSomething;
  39. end;
  40.  

And multiple inheritance is just more clear and safe way of doing exactly the same things.
I experienced the joy of metaprog in D and rich of this experience i can say that it's clear that's it's not possible in FPC. This requires multi-pass semantic, templates, and the most important, compile-time reflection. Object Pascal RTTI is an old but well working feature (used for the LCL GUI serialization for example ;) ) but it's not at all adapted to metaprog.
Too much changes to the compiler and language. Maybe a kind of pre-processor could work, to some extent.
Meta programming doesn't have to be dynamic. I see meta programs as compiler plugins. Something like Lazarus packages. You write "uses MyMetaModule;" this meta-module have some special structure. First compiler compiles it into some sort of MyMetaModule.dll plugin file (static linking to compiler itself - isn't good idea in this case) and then loads it and compiles program itself using it's features. Something like that.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 11, 2018, 01:28:14 pm
I don't think a fork is a good think - it depletes the resources on both.
But I also don't think that an opensource project should ban contributors, because that has the same effect.

...

An opensource project works on donations. But why donate when the things you want aren't done? Why donate if you have no saying at all in the priorities?
Therefore some suggestions:
1. Don't ban code contributors
2. Make a request list where anyone can add their wishes (needed fixes, needed syntax sugar, needed functionality)
3. Give donators votes to vote on this request list (the more you donate, the more votes you get)
4. Pay a fee (from the donations) to the developers to do the work on the most requested items

I fully agree almost with all. I agree that the fork is not good thing, but in my situation for the moment I have no choice (all was explained above...). Ok maybe the alternative is stopping all my work for compiler and RTL... Incoming weeks will be hard for me: many work not much visible in public (see below). After CI systems, more community things can be done (request list, voting, etc).

@BBasile, @Handoko, @Mr.Madguy : before I will continue my work on new compiler stuff a lot of work must be done, here I mean fully automated CI systems, especially:

* better auto-testing for compiler and mORMot (with easy to use page for looking for problems)
* auto releases for more platforms than just for Windows  (maybe with few cross-compilers "out of box")

no fireworks yet ;)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Zoran on May 11, 2018, 03:19:41 pm
So, while we're talking about a new and modern Pascal, can you provide named parameter feature? I think it's good and fit with Pascal's philosophy.
Does it? It fits in Python philosophy...

@bee every idea is welcome in NewPascal, I was not thinking about this feature yet, but looks promising and is worth to investigate! This may be a little delayed because I have a lot of work with reactivation of NewPascal. But when I finish I will back to this for sure.

I found that someone asked for it here: http://wiki.freepascal.org/Feature_Ideas#.22default.22-value_in_a_proc_or_function_call (http://wiki.freepascal.org/Feature_Ideas#.22default.22-value_in_a_proc_or_function_call)
I'm posting this because of the interesting comment below it:
Quote
If such a feature should exist, wouldn't it be more straightforward to simply not specify anything before the comma? (i.e. "Fly(, Amelia);")

Personally, I'm not a big fan of this feature at all, but I should say that the way proposed by this comment appeals much more to me than writing parameter names in function calls.
So, when (if ever) you start working on this, please think about the latter way.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 11, 2018, 04:34:17 pm
So, while we're talking about a new and modern Pascal, can you provide named parameter feature? I think it's good and fit with Pascal's philosophy.
Does it? It fits in Python philosophy...
It is actual Visual Basic philosophy. Not a good idea for register allocation and parsing. Can be done. I'd rather not see it in Pascal.

Quote
Personally, I'm not a big fan of this feature at all, but I should say that the way proposed by this comment appeals much more to me than writing parameter names in function calls.
So, when (if ever) you start working on this, please think about the latter way.
Where's the "feature" in that proposed "feature"?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: bee on May 12, 2018, 03:55:41 am
Does it? It fits in Python philosophy...
Many programming languages share some same principles, concepts, and philosophy. There's no such a programming language that truly unique in its whole concepts and principles. Some reasons why I love Pascal are the clarity, readability, and discipline. Though sometimes I feel it too verbose, but in the end I realize that it's Pascal, that's the way it is. If I need a different concepts and principles, I should use other programming language that fits my need better.

However, no matter how good Pascal's concepts and principles are, the implementation should be dynamic along the time. That's how a technology grows and evolves so it becomes better. In fact, many concepts that previously considered unpascalish, then somehow slowly accepted and implemented in Pascal using the Pascal's way. Otherwise, today we would be still using Wirth's Pascal implementation in the 70's.

Named parameter is adding clarity and readability to method parameters. I wonder why Pascal doesn't implement it since the beginning. However, as a new feature, I know it shouldn't break existing codes, so I proposed it as an option via {$modeswitch namedparameter} (or through a command line parameter, -Sp perhaps?). If you need it, simply enable it. If you don't, it won't bother you whatsoever.

Quote
If such a feature should exist, wouldn't it be more straightforward to simply not specify anything before the comma? (i.e. "Fly(, Amelia);")
No, it's very not pascalish. Comma is a punctuation. It completes something else. So, it should not exist all alone by itself. If you don't want to specify something then don't specify at all.

Personally, I'm not a big fan of this feature at all, but I should say that the way proposed by this comment appeals much more to me than writing parameter names in function calls.
Then it's not for you. But I think it's good that it's available as an option. I'll use it for sure.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 12, 2018, 09:52:31 am
I found that someone asked for it here: http://wiki.freepascal.org/Feature_Ideas#.22default.22-value_in_a_proc_or_function_call (http://wiki.freepascal.org/Feature_Ideas#.22default.22-value_in_a_proc_or_function_call)
Yeah, I would also want this feature. And I don't really understand, why there is such limitation - only last procedure/function parameters can have default values? It's purely meta-programming feature. I.e. if any parameter is skipped - it should be replaced with default value. As simple, as that. I.e. something like this should work:
Code: Pascal  [Select][+][-]
  1. procedure TList.Slice(AStart:Integer=0;AEnd:Integer=-1;AStep:Integer=1);
  2. begin
  3. ...
  4. end;
  5.  
  6. MyList.Slice(2,,2);
  7.  
And I also don't see, why such declaration is impossible:
Code: Pascal  [Select][+][-]
  1. procedure SomeProc(A:Integer=0;B, C:Integer);
  2.  
It's purely matter of Pascal standard - there is no such thing, as parameter skipping or default parameter symbol (something like "_" symbol) there. And this is purely parsing problem, I guess.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: howardpc on May 12, 2018, 01:51:40 pm
And I also don't see, why such declaration is impossible
Code: Pascal  [Select][+][-]
  1. procedure SomeProc(A:Integer=0;B, C:Integer);
  2.  
It's purely matter of Pascal standard - there is no such thing, as parameter skipping or default parameter symbol (something like "_" symbol) there. And this is purely parsing problem, I guess.

I imagine it is not a parsing problem. Obviously it could be done. It is a question of adopting syntax that slows down the compiler parser (which I believe is single-pass) as little as possible. If you require default parameters to be located it a certain position, you can parse slightly more quickly than if you have to plod through each element separately, to check if it is given a default or not. I prefer Object Pascal's compilation speed over C++'s multiple options and coffee-break length compilation. I honestly think it helps to be more productive when you can code/compile/unit-test in a second or two, rather than minutes or even longer intervals.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 06:45:48 am
Previously I had been giving you examples only, but I've analysed situation and, yeah, I have a list of features, I personally want to see in Pascal. Funny thing - I've never programmed on C/C++ seriously, but all my problems with Pascal boil down to lack of certain C/C++ features:
1) Delphi 2009 support, i.e. generics, closures and full Unicode support.
2) Multiple inheritance. Yeah, I can emulate it in Pascal, but my code suffers from memory usage and performance penalties, cuz code isn't optimized at binary level. Yeah, for example I use exactly the same wrappers, but they obviously aren't just ADD EAX, X and JMP Y. And of course it causes unclear and low quality code.
3) Extended operator overloading support. Overriding default := handling, similar to C/C++ "operator =" for example. Shorter explanation - I need to automate some assignment and initialization/finalization code for classes in a similar way, interfaces are handled, but without actually using interfaces.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Chronos on May 14, 2018, 09:55:13 am
Previously I had been giving you examples only, but I've analysed situation and, yeah, I have a list of features, I personally want to see in Pascal. Funny thing - I've never programmed on C/C++ seriously, but all my problems with Pascal boil down to lack of certain C/C++ features:
1) Delphi 2009 support, i.e. generics, closures and full Unicode support.
2) Multiple inheritance. Yeah, I can emulate it in Pascal, but my code suffers from memory usage and performance penalties, cuz code isn't optimized at binary level. Yeah, for example I use exactly the same wrappers, but they obviously aren't just ADD EAX, X and JMP Y. And of course it causes unclear and low quality code.
3) Extended operator overloading support. Overriding default := handling, similar to C/C++ "operator =" for example. Shorter explanation - I need to automate some assignment and initialization/finalization code for classes in a similar way, interfaces are handled, but without actually using interfaces.

1) Support for Delphi "new" features is always welcomed. I would personally like to have kind of FreeDelphi rather then FreePascal.
2) Multiple inheritance is problematic and usually not worth the cost. Therefore many language designers decided to not allow it.
3) This style operators overloading is already supported by FPC. http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Operator_Overloading_%28Delphi%29
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 10:17:47 am
1) Support for Delphi "new" features is always welcomed. I would personally like to have kind of FreeDelphi rather then FreePascal.
2) Multiple inheritance is problematic and usually not worth the cost. Therefore many language designers decided to not allow it.
3) This style operators overloading is already supported by FPC. http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Operator_Overloading_%28Delphi%29
2) Sorry, but this is the reason, why some people think, that C++ is better, than Pascal, and that at some point, when you become professional enough - you should migrate to C++. I've analysed it many times - there are no other way to complete my task in Pascal, other than so called class composition - i.e. storing references to ancestor classes right inside descendant classes and declaring 3-4 levels of wrapper methods. Otherwise I wouldn't be able to reuse code and that would mean copy-pasting exactly the same code many times, wasting memory on lots of references and extreme code size inflation. This is extremely clunky solution and means large memory usage and performance penalties. And while multiple inheritance implementation isn't free and uses similar methods, it's optimized at binary level, as in this case compiler knows, what should be done - for example wrappers have minimal possible code. And code becomes much more clear, readable and consistent. I've just tested my ideas in Borland C++ 3.1 - even this archaic compiler do this job perfectly.
3) Assignment operator isn't supported, as I know. You can't declare "operator Implicit(A:TMyType):TMyType" - compiler would complain about it.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 14, 2018, 10:39:11 am
2) Sorry, but this is the reason, why some people think, that C++ is better, than Pascal, and that at some point, when you become professional enough - you should migrate to C++. I've analysed it many times - there are no other way to complete my task in Pascal, other than so called class composition - i.e. storing references to ancestor classes right inside descendant classes and declaring 3-4 levels of wrapper methods.

It is a very rare pattern, and usually there are other ways around it (in the class composition) to work around it. One could argue needing it is a code smell.

There are maybe a few cases left, specially on the lowest level in runtime libraries

Specially for such lowlevel simple cases, in theory devirtualization and other global optimization techniques might reduce overheads of workarounds by inlining the delegated interface methods in the main class, eliminating the reference

Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 11:16:15 am
It is a very rare pattern, and usually there are other ways around it (in the class composition) to work around it. One could argue needing it is a code smell.

There are maybe a few cases left, specially on the lowest level in runtime libraries

Specially for such lowlevel simple cases, in theory devirtualization and other global optimization techniques might reduce overheads of workarounds by inlining the delegated interface methods in the main class, eliminating the reference
I don't think, that container pattern is rare.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 11:23:44 am
friends are not container patterns - the opposite is true - and are easily implemented with interfaces.
It should also be possible with a pure abstract and sealed pascal intermediate advanced record and a type cast, btw. That's how I initially got Steinberg's ASIO working on FPC and Delphi:
Make sure first VMT entry you are interested in start at offset 0. The FPC default entries have negative offsets, just like Delphi.

BTW it is enlightening to google for Bjarne Soustrup and "friends" in C++......(While E. Coyote)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 11:35:29 am
Make sure first VMT entry you are interested in start at offset 0. The FPC default entries have negative offsets, just like Delphi.

probably this is not true anymore, from RTL :
Code: Pascal  [Select][+][-]
  1.        { These were negative value's, but are now positive, else classes
  2.          couldn't be used with shared linking which copies only all data from
  3.          the .global directive and not the data before the directive (PFV) }  
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 11:38:32 am
Maciej, as far as I know it is when the record contains only abstract methods and is sealed too, the typecast on an external reference will work.
I will test, though. Would be bad if it does not work anymore, because it was a way to avoid flattening C++ classes....And these assume a VMT starting at 0.

Anyway friend patterns are not container patterns and easily solved with interfaces.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 12:14:13 pm
3) Assignment operator isn't supported, as I know. You can't declare "operator Implicit(A:TMyType):TMyType" - compiler would complain about it.

with NewPascal you can use management operators: AddRef and Copy instead of "operator Implicit(A:TMyType):TMyType", see:

https://github.com/newpascal/freepascal/blob/330aad68b600d7748fd337afa9aad93a4ee35464/tests/test/tmoperator8.pp
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 12:20:44 pm
Indeed, and that was a very valuable contribution. But it is also in trunk.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 12:24:17 pm
friends are not container patterns - the opposite is true - and are easily implemented with interfaces.
It should also be possible with a pure abstract and sealed pascal intermediate advanced record and a type cast, btw. That's how I initially got Steinberg's ASIO working on FPC and Delphi:
Make sure first VMT entry you are interested in start at offset 0. The FPC entries have negative offsets, just like Delphi.
Yeah, I know, that it's possible to be implemented via interfaces and 2nd level of abstraction in my project actually uses them. And I know, that I can use some crazy methods, like constructing classes/interfaces at runtime. I can also generate binary code at runtime, yeah. But all this solutions are clunky, don't you think? I just want to write clear and consistent code, like this:

Code: C++  [Select][+][-]
  1. template <class TKey, class TValue>
  2. struct TPair {
  3.   TKey Key;
  4.   TValue Value;
  5. };
  6.  
  7. template <class T>
  8. class TAbstractList {
  9. };
  10.  
  11. //Implementation
  12.  
  13. template <class T>
  14. class TList:virtual TAbstractList {
  15. };
  16.  
  17. //Pair list - reuses List features, but adds some pair-specific ones
  18.  
  19. template <class TKey, class TValue>
  20. class TAbstractPairList:virtual TAbstractList<TPair<TKey, TValue>> {
  21. };
  22.  
  23. //Please note! Implementation REUSES TList code
  24.  
  25. template <class TKey, class TValue>
  26. class TPair:virtual TList<TPair<TKey, TValue>>, virtual TAbstractPairList<TKey, TValue> {
  27. };
  28.  
  29. template <class T>
  30. class TAbstractSet {
  31. };
  32.  
  33. //Implementation - REUSES TList code!
  34.  
  35. template <class T>
  36. class TSet:virtual TList<T>, virtual TAbstractSet<T> {
  37. };
  38.  
  39. template <class TKey, class TValue>
  40. class TAbstractDictionary:virtual TAbstractSet<TPair<TKey, TValue>> {
  41. };
  42.  
  43. //Implementation - REUSES TPairList, TSet and TList!
  44.  
  45. template <class TKey, class TValue>
  46. class TDictionary:virtual TPairList<TKey, TValue>, virtual TSet<TPair<TKey, TValue>>, virtual TAbstractDictionary<TKey, TValue> {
  47. }
  48.  
And slight modification would allow us to cast set to list and dictionary to any other class.
Code: C++  [Select][+][-]
  1. template <class T>
  2. class TAbstractSet:virtual TAbstractList<T> {
  3. };
  4.  
  5. template <class TKey, class TValue>
  6. class TAbstractDictionary:virtual TAbstractPairList<TKey, TValue>, virtual TAbstractSet<TPair<TKey, TValue>> {
  7. };
  8.  
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 12:40:16 pm
Indeed, and that was a very valuable contribution. But it is also in trunk.
yes it is in trunk but for how long? The future of this feature is not safe in FPC trunk (I guess it can be removed). This is because:

* without FastRTTI it has some side effects
* Management Operators are more valuable with default field/property feature for smart pointers. Without this feature MO operators are not much usable
* my work for default field/properties is totally blocked in trunk, I am banned in core so it can't be discussed in normal way
* Management operators are in progress. There is idea for two more operators for safe/fast work with threads

without FastRTTI, without extensions and without "default field" feature, MO functionality should be removed from trunk because it brings more negatives than gains.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 01:00:04 pm
with NewPascal you can use management operators: AddRef and Copy instead of "operator Implicit(A:TMyType):TMyType", see:

https://github.com/newpascal/freepascal/blob/330aad68b600d7748fd337afa9aad93a4ee35464/tests/test/tmoperator8.pp
Yeah, that looks like what I actually want. But how about automated try...finally...end feature, interfaces have?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 01:02:42 pm
Yeah, that looks like what I actually want. But how about automated try...finally...end feature, interfaces have?
Finalize operator is called even when exception occurs, so you don't need to use "try finally end" for records with Management Operators.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 01:14:25 pm
Finalize operator is called even when exception occurs, so you don't need to use "try finally end" for records with Management Operators.
Ok. Only multiple inheritance left and I'll be happy.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 03:57:10 pm
Multiple inheritance would make me freeze the last build before it was introduced and never look forward again.
It is the single baddest thing to - out of many - have, as Bjarne Soustrup agrees, in C++.
And we have multiple inheritance through interfaces, which is less likely to cause stupid non-maintainable code.

Look at it in the light of "with" syntax: it causes mayhem, because people start to use it...Never trust programmers...
They tend to forget or not know about scope...
Multiple inheritance - C++ style - is BAD!. Just like "with" is. Multiple inheritance interface style is sane, but we have that already.

There is no sane way to resolve name clashes using C++ other than scoping explicitly. Which renders it useless. If I see it during code reviews, I insist on having that code changed/removed.
[edit]
Note Maciej's management operators (and Sven, he made some contributions if I am not mistaken) work very, very well and I use them a lot in new code.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 14, 2018, 04:29:44 pm
How about allowing this for generics:

Code: Pascal  [Select][+][-]
  1.   TMakeSpatial < T: TObject > = class ( T )
  2.       //[..]
  3.       procedure RotateAroundAxis( Axis: TVec3; Angle: Single );
  4.       property Position: TVec3 read FPosition write FPosition;
  5.       property Rotation: TVec3 read FRotation write FRotation;
  6.   end;
  7.  
  8.   TMakeRenderable < T: TObject > = class ( T )
  9.       //[..]
  10.       procedure Render;
  11.       property Visible: Boolean read FVisible write FVisible;
  12.   end;
  13.  
  14.  
  15.   TSomeClass = class( TMakeSpatial < TObject > )
  16.   end;
  17.  
  18.   TAnotherClass = class( TMakeSpatial < TMakeRenderable < TObject > > )
  19.   end;
  20.  
  21.   TThirdClass = class( TMakeRenderable< TObject >);
  22.  

I think it's perfectly understandable, doesn't require many changes in the compiler (I think so because it is even possible but does not work in some cases). It does not require real multiple inheritance but it has all the benefits of it. Even "is" and "as" operators work in combination with interfaces. I've used this for some time in my engine and removed it because it did not work in all cases and code completion does not support it. I think it is more a hack than a feature at the moment.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 04:30:00 pm
Note Maciej's management operators (and Sven, he made some contributions if I am not mistaken) work very, very well and I use them a lot in new code.
It was consulted with Jonas, Florian and Sven. Management Operators functionality was made by me. IIRC when final patch was ready, Sven was against the management operators and he did not want them in trunk.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 05:43:05 pm
Multiple inheritance would make me freeze the last build before it was introduced and never look forward again.
It is the single baddest thing to - out of many - have, as Bjarne Soustrup agrees, in C++.
And we have multiple inheritance through interfaces, which is less likely to cause stupid non-maintainable code.

Look at it in the light of "with" syntax: it causes mayhem, because people start to use it...Never trust programmers...
They tend to forget or not know about scope...
Multiple inheritance - C++ style - is BAD!. Just like "with" is. Multiple inheritance interface style is sane, but we have that already.

There is no sane way to resolve name clashes using C++ other than scoping explicitly. Which renders it useless. If I see it during code reviews, I insist on having that code changed/removed.
[edit]
Note Maciej's management operators (and Sven, he made some contributions if I am not mistaken) work very, very well and I use them a lot in new code.
Dunno. I've never had any problems with "with". At the end it's just namespace feature. You just need to understand, how namespaces work - that's it. If you personally don't understand, how they work =/= they're bad feature. Ambiguities don't just magically appear - you create them. Just don't do it and everything will be fine.

Problem is - I don't need multiple inheritance to do something new. I have existing code, I've been developing for several years. I couldn't just give up - I needed to make it work the way, it was required. And I tried EVERYTHING, I could try, to avoid any complexity in my code, while keeping it functional - to make it as simple, as clear and as consistent, as possible. And I use class composition in my code anyway, cuz I have no other choice. Nothing can be worse, than class composition. Nothing can be clunkier, slower and less memory inefficient. So, multiple inheritance would actually make my code better.

I.e. code itself requires this feature. Dunno, how to explain it better. That's, how OOP itself was invented. People were using records and passing them as pointers back them. They just wanted to automate their workflow, make code more clear and consistent. Same here.

And... Interfaces actually work exactly the same way, as multiple inheritance - new VMT is created for every interface implemented, filled with wrapper functions, that add deltas to Self pointer. And implementations are "hidden" inside class, that implements this interfaces. Multiple inheritance actually works exactly the same way - you just can keep implementations separated from each other and mix them in any combinations.

Example: this two are equal.
Code: Pascal  [Select][+][-]
  1. IInterface1 = interface;
  2. IInterface2 = interface;
  3. IInterface3 = interface;
  4.  
  5. TClass1 = class(TInterfacedObject, IInterface1);
  6. TClass2 = class(TClass1, IInterface2);
  7. TClass3 = class(TClass2, IInterface3);
  8.  
  9. TFinalClass = TClass3;
  10.  
Code: C++  [Select][+][-]
  1. class TAbstractClass1;
  2. class TAbstractClass2;
  3. class TAbstractClass3;
  4.  
  5. class TClass1:TAbstractClass1;
  6. class TClass2:TAbstractClass2;
  7. class TClass3:TAbstractClass3;
  8.  
  9. class TFinalClass:TClass1, TClass2, TClass3;
  10.  
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 05:48:51 pm
I've been developing for several years. I couldn't just give up - I needed to make it work the way, it was required. And I tried EVERYTHING,
Like several as in over 40+ years and 35 with a degree?? Now show me the problem you can't fix.... You are being either stubborn or silly. (Note most of my work is done in C++, just in case..., don't hold that against me, I'd rather use Pascal full time. Which I did at some point...)

Show us the code..... I don't believe there is no clean solution...(and the above is highly inadequate)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 06:12:25 pm
Like several as in over 40+ years and 35 with a degree?? Now show me the problem you can't fix.... You are being either stubborn or silly. (Note most of my work is done in C++, just in case..., don't hold that against me, I'd rather use Pascal full time. Which I did at some point...)

Show us the code..... I don't believe there is no clean solution...(and the above is highly inadequate)
I've already shown structure of my code. This part still can be implemented via interfaces - no doubts. And it WAS implemented this way in version 1.0. Problem is - code was still too complex and it's scalability was bad. If I would want to add new features - I would need to completely rewrite large amounts of code every time. For example I wanted to add "cyclic buffer" feature. As all data access was implemented at implementation level - I needed to completely rewrite all implementations. So I needed another level of abstraction to keep such changes as local, as possible - so called "data access driver". And this one can't be implemented via interfaces, cuz it requires it's own inheritance stucture - via class composition only. And with multiple inheritance it would be possible to implement it via "delegation to sister class".

What is most powerful feature of multiple inheritance? Implementation of abstract class can be bound to class structure at any moment. Class becomes something like Lego - you can connect any parts at any moment. You aren't limited by vertical structure only.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 14, 2018, 06:42:02 pm
What is most powerful feature of multiple inheritance? Implementation of abstract class can be bound to class structure at any moment. Class becomes something like Lego - you can connect any parts at any moment. You aren't limited by vertical structure only.
Hm. You just admitted you really do not understand. The concept you are looking for in an abstract way are interfaces. These work really like Lego blocks.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 07:26:53 pm
Hm. You just admitted you really do not understand. The concept you are looking for in an abstract way are interfaces. These work really like Lego blocks.
Interfaces - are just different ways to interact with the same implementation. And this implementation obeys ordinal inheritance rules. Only way to modify behaviour of existing implementation - to add descendant class on the top of it, that would override some virtual methods. But what if this "slot" is reserved for something else? Imagine, that my containers have different ways to access data, depending on data itself. This can be achieved via having some abstract "data access" class on a bottom of class structure and implementing it on a top. They may have their own inheritance structure. But what if I need to have another container class, that needs to reuse code of some existing container? It should be implemented as descendant class too, but... We can no longer attach our "data access" classes to the top of it - we need to completely reimplement them, i.e. simply copy-paste the same code. Now imagine, that I need 3, 4, 5, 10, 20 of such containers. And I have 3, 4, 5, 10, 20 data access methods. Will I also need to copy-paste my "data access" classes 3, 5, 100500 times? This is called "scalability problem", you know. No, I don't want to do it. I will use virtual inheritance, multiple inheritance provides. "Data access" classes can be implemented only once. And then I can "virtually" inherit from them at any moment.

I can do this:
Code: C++  [Select][+][-]
  1. class TAbstractList:virtual TAbstractDataAccessDriver;
  2. class TList:TAbstractList, virtual TMyDataAccessDriver;
  3.  
This:
Code: C++  [Select][+][-]
  1. class TAbstractPairList:TAbstractList;
  2. class TPairList:TAbstractPairList, virtual TMyDataAccessDriver;
  3.  
And this:
Code: C++  [Select][+][-]
  1. class TAbstractDictionary:TAbstractPairList;
  2. class TDictionary:TAbstractDictionary, virtual TMyDataAccessDriver;
  3.  

And I can't do the same thing via interfaces. Two or any arbitrary number of parallel inheritance chains aren't possible with interfaces, sorry. And using class composition means storing extra pointers, constantly resolving them to access data and having tons of wrapper functions. It's reasonable in one case only - when I need to share same "driver" class between several instances of "implementation" classes. But it's not my case.

P.S. Multiple inheritance works just perfectly in C++, but I have another problem - problem with templates. All of a sudden TAbstractList<TPair<TKey, TValue>>, I use in Delphi very often, refuses to compile in C++. Both in old obsoleted BC++ 3.1 and in modern C++ Builder. What can be wrong with it? According to docs C++ has even more freedom in using generics, than Delphi.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 08:39:51 pm
my 2 cents on multiple inheritance =

I was there when turbo pascal 5.1 discussed if it needed to be implemented. the reslult of the comittee (after 3 days of biggest brains around world conversation) is as simple as follow =>

Please noobinosss PLEASE NEVER add such crap as multiple inheritance into TRUE Pascal because of the so called "diamond of DEATH" that turns C++ into an HELL on medium and large object projects

PLEASE Keep Pascal 's Tradition away from such HELL, or the basic Pascal Concepts fron His Inventor Niklaus Wirtth (meaning "easy to learn, clear, simple, fast compiled with no preprocssing shit)  would be hardly footed and broken away

THANKS
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 08:52:12 pm
my 2 cents on multiple inheritance =

I was there when turbo pascal 5.1 discussed if it needed to be implemented. the reslult of the comittee (after 3 days of biggest brains around world conversation) is as simple as follow =>

Please noobinosss PLEASE NEVER add such crap as multiple inheritance into TRUE Pascal because of the so called "diamond of DEATH" that turns C++ into an HELL on medium and large object projects

PLEASE Keep Pascal 's Tradition away from such HELL, or the basic Pascal Concepts fron His Inventor Niklaus Wirtth (meaning "easy to learn, clear, simple, fast compiled with no preprocssing shit)  would be hardly footed and broken away

THANKS
This same "diamond of death" allows "delegate to sister class" pattern. And, as I've already said: if you don't want to deal with ambiguities - just don't create them. As simple, as that. Interfaces have the same problem - same method names in different interfaces. Dunno about Lazarus, but Delphi has some major problems with them. No overloading possible, even explicit declarations fail with "Missing implementation" errors. I've already provided example with interface aliases, that fails in Delphi.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: hnb on May 14, 2018, 08:56:19 pm
multiple inheritance is pandora's box, but in any idea something valuable can be found and can be transformed into something new, maybe in other form.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 08:58:14 pm
yup @hnb now evrybody here have the true reason why it has never been implemented into pascal for 25 years ...ago...  :D :P ;)

... and in 25 years we had time to do it if useful you can thrust that  :-*
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 09:01:51 pm
... time and bigger brains that you can imagine to implement it  :)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 14, 2018, 09:02:57 pm
multiple inheritance is pandora's box, but in any idea something valuable can be found and can be transformed into something new, maybe in other form.
May be I don't need multiple inheritance itself - virtual inheritance is more interesting for me. I was thinking about it, as about something like "subclassing" - i.e. when I can create some "subclass", that can override any virtual methods, while not respecting any inheritance structure.
yup @hnb now evrybody here have the true reason why it has never been implemented into pascal for 25 years ...ago...  :D :P ;)

... and in 25 years we had time to do it if useful you can thrust that  :-*
Back then it had very clunky implementation, that was very costly...for that time. Deltas right in VMTs, no matter, if multiple inheritance is used or not. But today it doesn't matter anymore - any interface uses wrapper for every method anyway.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: ASerge on May 14, 2018, 10:17:18 pm
Multiple inheritance - C++ style - is BAD!. Just like "with" is. Multiple inheritance interface style is sane, but we have that already.
+1
Please noobinosss PLEASE NEVER add such crap as multiple inheritance into TRUE Pascal because of the so called "diamond of DEATH" that turns C++ into an HELL on medium and large object projects
PLEASE Keep Pascal 's Tradition away from such HELL, or the basic Pascal Concepts fron His Inventor Niklaus Wirtth (meaning "easy to learn, clear, simple, fast compiled with no preprocssing shit)  would be hardly footed and broken away
+1
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 14, 2018, 10:28:20 pm
I also think MI is too much trouble for too little practical gain. (and I doubt even that little bit of gain)

Moreover, such a major feature will cause a whole new dimension of corner cases with existing features like Generics (which are still stabilizing), unicode (ditto) and various forms of operator overloading.

Whatever you think of MI and similar fundamental changes, now is not the time. Maybe in 5-10 years.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 14, 2018, 10:33:41 pm
Sorry for bumping but did anyone read my post? Because it could be a way to "fake" multiple inheritance with all the benefits but without the "HELL" part and without changing the compiler (At least I think so) much and also without introducing any new syntax but using generics. By using the normal class syntax it is already clear how to deal with name ambiguities.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: marcov on May 14, 2018, 10:39:25 pm
Sorry for bumping but did anyone read my post? Because it could be a way to "fake" multiple inheritance with all the benefits but without the "HELL" part and without changing the compiler (At least I think so) much and also without introducing any new syntax but using generics. By using the normal class syntax it is already clear how to deal with name ambiguities.

I never did understand how polymorphism works in such case. So how do I work with such class while only knowing it is something spatial?

With interfaces, you get some ISpatial reference from whatever and work with that.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 14, 2018, 10:50:41 pm
Oh it's actually simple. It's just a class but when declaring the generic the parent is not yet clear but when specializing it is. This way you can not tell if a class is a descendent of any TSpatial specialization but you can still use an interface.
With interfaces alone you would have to rewrite the whole functionality for each of the implementations or make an abstract class which might be a lot more effort to manage.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 14, 2018, 10:58:32 pm
This functionality is already "implemented" or at least not forbidden. I think in delphi it is, so you could say it is a bug. However you cannot override a constructor for some reason and code completion does not work for any class that inherits this type. I've given an example on this before in another topic.
http://forum.lazarus.freepascal.org/index.php/topic,37278.msg250206.html#msg250206
You will find a compilable example there without interfaces though. If anyone is interested I could supply a complete example with interfaces. However it seems nobody understood what I was talking about, so maybe I'm not good at explaining this.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 11:00:14 pm
polymorphism is quite easy to simulate with pascal =>

1) use interfaces when you only need a bunch of common methods (no data) to all "inheriter objects"

2) encapsulate objects inside objects when you need to add more data structures (this will avoid diamond of death) E.G.

suppose you have a class A; a class B; and you need a class C encapsulating A and B

class C = begin class
 a : of type A;
 b : of type B;
public methods
 wrappers methods from A and B
 constructor calling wrappers constructors
end public methods
end class

is moe or less equivalent to crapy C++ class C(A,B)

so I can't believe @Marcov (5-10 years) argument, MINE IS DEF WE WILL NEVER NEVER AND NEVER NEED C++ craps
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Zoran on May 14, 2018, 11:04:23 pm
Also note that all classes in Pascal are inherited from TObject. Therefore every multiple inheritance in Pascal would create a diamond. %)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 11:05:53 pm
Also note that all classes in Pascal are inherited from TObject. Therefore every multiple inheritance in Pascal would create a diamond. %)
+1
and break structured programming (and RTTI) forever
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 14, 2018, 11:10:30 pm
@Sam: True but is there no overhead because you have to call the methods of either class A or B? Also to my knowledge you would have to write a lot more code because you would have to implement all the functions in class C (at least the headers) again and in the bodies of C you would have to write very stupid boiler plate code (or maybe you can use the implements keyword for interfaces?). If not can you maybe give an example with real code?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 14, 2018, 11:17:46 pm
@Sam: True but is there no overhead because you have to call the methods of either class A or B? Also to my knowledge you would have to write a lot more code because you would have to implement all the functions in class C (at least the headers) again and in the bodies of C you would have to write very stupid boiler plate code (or maybe you can use the implements keyword for interfaces?). If not can you maybe give an example with real code?
and to your opinion what does a C++ compiler do except try to make assembly code following your "overhead assertion" to make it compat with my preceeding algorithm???

I prefer as long time pascal user to STRUCTURE my code point by point, being sure the compiler won't hang in inheritance guessings!
I worked also many years with Qt (C++), and there where nights I couldn't sleep fighting code because i (or one of my coworker) had wrote lazy code around inheritance, misuderstood by gnu C++.

SO it's a choice, either you prefer C++ craps and being LAZY, either you prefer to structure your mind and your code and being PASCALISH

finally you'll find out being LAZY brings you damn much more work LOL!!!!
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 12:17:51 am
I don't know (and don't care) what exactly C++ does but if you have a VMT you can simply look for a pointer to the function there and call it directly. With a wrapper class you would have to make a method calling another method. That's what I mean with overhead.
I don't say I'm for multiple inheritance but I understand what the OP (about multiple inheritance not the original OP  :) ) is saying about an overhead which you cannot get rid of so If you have a pascalish solution for the problem it would opt for your point that it is not necessary but this is difficult without a good code example. In my case I found out that I don't really need the multiple inheritance but in a different case I did not find a "nice" solution yet (A working one though). For me it is fine at the moment because it works, so I would be interested in a solution.
So I'm also not against multiple inheritance per se but if my code I posted before was fully supported it would solve most of the problems already but maybe I don't really understand the exact problem you refer to with "Diamond of Hell" because I never worked with C++.
Do you mean that you can override a method in two classes and it is not clear to the user which method will be called by the compiler? Because this is also possible with single inheritance. Or is it about the order in which inherited methods are called in a method's body?
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 12:35:49 am
Ok I found this: https://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem

So I try to show how my solution would solve the problem with the GUI example:

Code: Pascal  [Select][+][-]
  1. type
  2.   TGUIObject = class
  3.      function equals( Obj: TGUIObject ): Boolean; virtual;
  4.   end;
  5.  
  6.   TRectangle < T > = class ( T )
  7.      function equals( Obj: TGUIObject ): Boolean; override;
  8.   end;
  9.  
  10.   TClickable < T > = class ( T )
  11.      function equals( Obj: TGUIObject ): Boolean; override;
  12.   end;
  13.  
  14.   TButton1 = class( TRectangle < TClickable < TGUIObject >>)  // equals of TRectangle will be called
  15.   end;
  16.  
  17.   TButton2 = class( TClickable < TRectangle <TGUIObject >>)  // equals of TClickable will be called
  18.   end;
  19.  
So when specializing the generic it is clear which methods to call because it single inheritance actually.
This sentence from the wikipedia page is still true:
Quote
Free Pascal uses the "last man standing" rule, where there is a reference to two identifiers that have the same name, whichever is the last one defined is the one that is used. So if there is a Unit A and a Unit B that have a variable named Q, if the declaration is "USES A,B;" then a reference to Q will use B.Q.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 15, 2018, 02:02:52 am
huh see what i mean when i wrote "lazy" against structured pascalish? why don't you put "diamond of death c++" into your browser search engine and ... press the [Return] key with one of your hand plenty of fingers? can't choose one??? LOL!!

(I'm gonna be a professional LOLer here)
 :D
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 15, 2018, 02:05:47 am
if you need to learn about retreiving methods lists by names or pointers for them to be nicely exported to scriptengine(s) or other programs, and VMTs, i suggest you to install pascalscript package and ... well... if you're a structured courageous pascalish user, ... READ (at least) test and DEBUG (at best)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 02:53:26 am
What is it with all the offensiveness? I did not know there was a paradigm of the diamond of death until I did google it. When I googled it I replied that I found the answer already. And I posted code that showed there is no diamond of death in pascal with my solution. Wan't me to start a NewNewPascal? This is how the thread started in the first place. This is only bashing and no discussion. I know now you're against multiple inheritance, I just don't know why because you didn't explain what is wrong with my code (Which isn't even real multi inheritance). The code works already (with function headers and unit stuff added). It is either a bug in the compiler or a broken feature (because of the problems with the destructor and code completion (not in the compiler, I know)) depending on how you see it. It is not the only way to fake multi inheritance by the way. You can also do it with macros and includes but it is kind of ugly.
So can't we just be friendly? It would help the Free Pascal community a lot more than any new feature.
But maybe I got you all wrong and your post wasn't meant as an offense. In this case I didn't get it. Otherwise I'm out of this "discussion" until we are back to normal.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 15, 2018, 05:52:01 am
What is it with all the offensiveness? I did not know there was a paradigm of the diamond of death until I did google it. When I googled it I replied that I found the answer already. And I posted code that showed there is no diamond of death in pascal with my solution. Wan't me to start a NewNewPascal? This is how the thread started in the first place. This is only bashing and no discussion. I know now you're against multiple inheritance, I just don't know why because you didn't explain what is wrong with my code (Which isn't even real multi inheritance). The code works already (with function headers and unit stuff added). It is either a bug in the compiler or a broken feature (because of the problems with the destructor and code completion (not in the compiler, I know)) depending on how you see it. It is not the only way to fake multi inheritance by the way. You can also do it with macros and includes but it is kind of ugly.
So can't we just be friendly? It would help the Free Pascal community a lot more than any new feature.
But maybe I got you all wrong and your post wasn't meant as an offense. In this case I didn't get it. Otherwise I'm out of this "discussion" until we are back to normal.
Fist of all, interfaces have exactly the same "diamond of death" problem, as multiple inheritance. They have lesser problems, cuz they have lesser features - no fields, no constructors, etc. But remember this? Method name ambiguity, yeah.
Code: Pascal  [Select][+][-]
  1. IInterface1 = interface
  2.   procedure MyMethod;
  3. end;
  4.  
  5. IInterface2 = interface
  6.   procedure MyMethod;
  7. end;
  8.  
  9. TMyClass = class(TInterfacedObject, IInterface1, IInterface2)
  10.   procedure MyMethod1;
  11.   procedure MyMethod2;
  12.   //Diamond of death disambiguation here
  13.   procedure IInterface1.MyMethod = MyMethod1;
  14.   procedure IInterface2.MyMethod = MyMethod2;
  15. end;
  16.  
I.e. "diamond of death" - is possible situation only, so it should be dealt with somehow on compiler level. It's programmer himself, who create it. And it's up to programmer to avoid it. I.e. if you don't know, how to properly use some feature - don't just mindlessly use it. Any feature should be used as a tool to solve some problems and one should clearly understand, how it works, not just use it, cuz it exists.

Second. Sorry, that I haven't noticed your code. That's, what I need. Does it really work now? It can be solution of my problems, cuz I was seeing it as some sort of "subclass" feature. Something like this:
Code: Pascal  [Select][+][-]
  1. TAbstractClass = class
  2.   procedure SomeMethod;virtual;abstract;
  3. end;
  4.  
  5. TSubclass = subclass(TAbstractClass)
  6.   procedure SomeMethod;override;
  7. end;
  8.  
  9. //TAbstractClass somewhere in inheritance stucture
  10.  
  11. TSomeAncestor = class(TAbstractClass);
  12.  
  13. //Actual implementation
  14.  
  15. TMyClass = class(TSomeAncentor);
  16.  
  17. //Now we subclass it
  18.  
  19. MyObject := TMyClass.Create;
  20. Subclass(MyObject, TSubclass);
  21. //Or may be
  22. TSubclass.Subclass(MyObject);
  23. //Or another variant
  24. NewObject := TSubclass.Subclass(MyObject);
  25.  
And your code does exactly the same, but statically.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 10:03:59 am
Partly, I tried it again, but found that you cannot override methods at all because it always complains it could not find the method in the base class. I didn't need to for my purposes. Except for that, it works, but I would't want to rely on it especially in productive code, to be still working in the future.
If you like a more future proof version which does exactly the same but looks ugly you can use this.

Code: Pascal  [Select][+][-]
  1. //testclass.inc
  2. {$IFDEF INTERFACE}
  3. type
  4.   TTestClass = class ( T )
  5.      procedure SomeProcedure; override;
  6.   end;
  7. {$ENDIF}
  8. {$IFDEF IMPLEMENTATION}
  9. procedure TTestClass.SomeProcedure;
  10. begin
  11.   WriteLn( 'TTestClass.Some procedure' );
  12. end;
  13. {$ENDIF}
  14.  

Code: Pascal  [Select][+][-]
  1. ...
  2. interface
  3.   {$MACRO ON}
  4.   {$DEFINE T:= TSomeParent}
  5.   {$DEFINE TTestClass:= TMyTestClassWithSomeParent}
  6.   {$DEFINE INTERFACE}
  7.   {$INCLUDE testclass.inc}
  8.   {$UNDEF INTERFACE}
  9.   {$UNDEF T}
  10.   {$UNDEF TTestClass}
  11.  
  12. implementation
  13.   {$DEFINE T:= TSomeParent}
  14.   {$DEFINE TTestClass:= TMyTestClassWithSomeParent}
  15.   {$DEFINE IMPLEMENTATION}
  16.   {$INCLUDE testclass.inc}
  17.   {$UNDEF IMPLEMENTATION}
  18.   {$UNDEF T}
  19.   {$UNDEF TTestClass}
  20.  
  21. end.
  22.  

I attached a fully compilable example. If you really need this feature than this is your solution. It makes the code less readable though. My other code would be a solution if it was fully implemented.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 15, 2018, 12:13:20 pm
Yeah, unfortunately this doesn't work. Lazarus complains about no method to override and Delphi is even smarter - it gives "Class type required", when declaring TSubclass. Looks like this fact, that you can do it in Lazarus - is simple bug, that allows undocumented behavior.
Code: Pascal  [Select][+][-]
  1.   TAbstractClass = class
  2.     procedure DoSomething;virtual;abstract;
  3.   end;
  4.  
  5.   TImplementationClass = class(TAbstractClass)
  6.     procedure DoSomethingElse;
  7.   end;
  8.  
  9.   TSubclass<T:TAbstractClass> = class(T)
  10.     procedure DoSomething;override;
  11.   end;
  12.  
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 02:09:39 pm
Quote
Looks like this fact, that you can do it in Lazarus - is simple bug, that allows undocumented behavior.
This is also my guess.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 15, 2018, 02:38:17 pm
Code: Pascal  [Select][+][-]
  1.   TAbstractClass = class
  2.     procedure DoSomething;virtual;abstract;
  3.   end;
  4.  
  5.   TImplementationClass = class(TAbstractClass)
  6.     procedure DoSomethingElse;
  7.   end;
  8.  
  9.   TSubclass<T:TAbstractClass> = class(T) // Huh??? What is T (2) doing there? Any clue? Integer? record? single? maybe even an object or do you mean a class.....silly?
  10.     procedure DoSomething;override;
  11.   end;
  12.  
That code is bollocks in any language. Bad code is bad code. Bad programmers are bad programmers. And even proper programmers can write bad code (you just did:QED).
A thoroughly good example, btw, of such nonsense. It is a recursion and can not be resolved to be precise (not even in C++ syntax).

Start with
Code: Pascal  [Select][+][-]
  1. TAbstractClass = class<T:class, constructor>;
Which is also nonsense (Of course a class is a class...), but better nonsense.... O:-) 8-)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 02:57:48 pm
Code: Pascal  [Select][+][-]
  1.   TAbstractClass = class
  2.     procedure DoSomething;virtual;abstract;
  3.   end;
  4.  
  5.   TImplementationClass = class(TAbstractClass)
  6.     procedure DoSomethingElse;
  7.   end;
  8.  
  9.   TSubclass<T:TAbstractClass> = class(T) // Huh??? What is T (2) doing there? Any clue?
  10.     procedure DoSomething;override;
  11.   end;
  12.  
That code is bollocks in any language. Bad code is bad code. Bad programmers are bad programmers.
A thoroughly good example, btw, of such nonsense. It is a recursion and can not be resolved to be precise (not even in C++).

Start with
Code: Pascal  [Select][+][-]
  1. TAbstractClass = class<T:class, constructor>;
Which is also nonsense (Of course a class is a class...), but better nonsense....

I don't understand. Do you mean:
Code: Pascal  [Select][+][-]
  1.  
  2. TAbstractClass <T:class, constructor> = class
  3. end;
Because this compiles.
The T in Line 9 means the generic is supposed to inherit T which gets resolved when specializing.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 15, 2018, 03:02:40 pm
That compiles and is correct. For T to resolve during inheritance it needs to be in the <> brackets. Anything else is bollocks.
Note I do not use silly mode. I use {$mode delphi}
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: sam707 on May 15, 2018, 03:02:50 pm
who seen me as "offensive" because I compare structured mindS and lazy twirled oneS presumed born on a trash with rocket science?

the 1) question is : did you ever meet an offensive person? LOL!!! my answer is NO you r made from sugar and afraid of water

advices :

If some feel concerned, just go and learn (as I suggested => googole is yer friend) hahaha left handled wrote code

hmm @Thaddy +10 on yer last one (even iif I hate you, dark bro) hehehehe
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Thaddy on May 15, 2018, 03:04:51 pm
 8-)
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 15, 2018, 05:55:22 pm
That code is bollocks in any language. Bad code is bad code. Bad programmers are bad programmers. And even proper programmers can write bad code (you just did:QED).
A thoroughly good example, btw, of such nonsense. It is a recursion and can not be resolved to be precise (not even in C++ syntax).

Start with
Code: Pascal  [Select][+][-]
  1. TAbstractClass = class<T:class, constructor>;
Which is also nonsense (Of course a class is a class...), but better nonsense.... O:-) 8-)
Well, that's not my code. soerensen3 has said (http://forum.lazarus.freepascal.org/index.php/topic,41128.msg285945.html#msg285945), that such pattern works and it interested me. I've tired it and found out, that even if it partially works - it's compiler bug, as Delphi doesn't allow this trick.

I guess, if this trick would work, this:
Code: Pascal  [Select][+][-]
  1.   TSubclass<TImplementationClass>
  2.  
would resolve into this:
Code: Pascal  [Select][+][-]
  1.   TSubclass = class(TImplementationClass)
  2.     procedure DoSomething;override;
  3.   end;
  4.  
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: soerensen3 on May 15, 2018, 08:55:19 pm
I guess, if this trick would work, this:
Code: Pascal  [Select][+][-]
  1.   TSubclass<TImplementationClass>
  2.  
would resolve into this:
Code: Pascal  [Select][+][-]
  1.   TSubclass = class(TImplementationClass)
  2.     procedure DoSomething;override;
  3.   end;
  4.  

Exactly! And this trick DOES work, without any diamonds. Try this code:
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. {$MODE DELPHI}
  3.  
  4. uses
  5.   Classes;
  6.  
  7. type
  8.  
  9.   { TAbstractClass }
  10.  
  11.   TAbstractClass < T: class> = class ( T )
  12.     procedure ShowInheritance;
  13.   end;
  14.  
  15. { TAbstractClass }
  16.  
  17. procedure TAbstractClass<T>.ShowInheritance;
  18. var
  19.   C: TClass;
  20. begin
  21.   WriteLn( ClassName + ' inheritance: ' );
  22.   C:= ClassType;
  23.   while ( Assigned( C )) do begin
  24.     WriteLn( '  ' + C.ClassName );
  25.     C:= C.ClassParent;
  26.   end;
  27.   WriteLn( '-----------------' );
  28. end;
  29.  
  30. var
  31.   Obj: TAbstractClass < TPersistent >;
  32.   Obj2: TAbstractClass < TStringList >;
  33.  
  34. begin
  35.   Obj:= ( TAbstractClass < TPersistent >).Create;
  36.   Obj2:= ( TAbstractClass < TStringList >).Create;
  37.   Obj.ShowInheritance;
  38.   Obj2.ShowInheritance;
  39.   Obj.Free;
  40.   Obj2.Free;
  41. end.
  42.  

This is the output:
Code: [Select]
TAbstractClass<Classes.TPersistent> inheritance:
  TAbstractClass<Classes.TPersistent>
  TPersistent
  TObject
-----------------
TAbstractClass<Classes.TStringList> inheritance:
  TAbstractClass<Classes.TStringList>
  TStringList
  TStrings
  TPersistent
  TObject
-----------------

I also said it is probably a bug and I also made a bugreport about it some time ago. It is still open (https://bugs.freepascal.org/view.php?id=32054).

Code: Pascal  [Select][+][-]
  1. TAbstractClass = class<T:class, constructor>;
This also makes no sense in any syntax. Apart from the missing brackets for the inheritance part the < T > part has to be on the left side. After that the type T is declared and can be used without the <> (Except for the function name in the body in Delphi mode).
This is from the RADStudio documentation (http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Declaring_Generics). I added some comments.

Code: Pascal  [Select][+][-]
  1.  type
  2.    TPair<TKey,TValue> { TKey and TValue are declared here and can be used without <> from here on} = class   // TKey and TValue are type parameters
  3.      FKey: TKey; // If type TKey can be used here, why not in the inheritance part after the class keyword?
  4.      FValue: TValue;
  5.      function GetValue: TValue;
  6.    end;
Embarcadero just decided not to support this behaviour. This doesn't mean it makes no sense. They could have decided for the opposite as well. Whoever wrote this part of the fpc compiler propbably did not think of this option, so it does not generate an error.
Title: Re: NewPascal plans, Generics.Collections and FPC trunk
Post by: Mr.Madguy on May 16, 2018, 06:19:14 am
This pattern is useless for me, if it can't override virtual methods. What is also bad about it: as this solution is based on using generics, it allows me to reuse code at source level only - at binary level code is still duplicated. And one of things, I actually want to avoid - is binary size inflation. That's why I stopped using the simplest possible solution, I've used in version 0.x - full reimplementation of every abstract class. And what is good about multiple inheritance - it allows binary code reusing.
TinyPortal © 2005-2018