Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 21:07 schrieb "Ondrej Pokorny" : > > On 01.09.2017 18:38, Sven Barth via fpc-devel wrote: >> >> What if I do the initial specialization in a unit that does not know about the helper? It can't just do speculative specialization once both the specialized generic and the generic helper a

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Ondrej Pokorny
On 01.09.2017 18:38, Sven Barth via fpc-devel wrote: What if I do the initial specialization in a unit that does not know about the helper? It can't just do speculative specialization once both the specialized generic and the generic helper are used in the same unit. And even if the compiler wo

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Stefan Glienke
As I said for me then it's rather useless for what I see the benefit in helpers for generic types. It's not even close to the benefit I get from extension methods in C# (yeah, I know generics work a bit different there). Having really slim interfaces like IEnumerable or IObservable which both ha

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Maciej Izak
2017-09-01 18:30 GMT+02:00 Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org>: > I'd prefer to keep that syntax for aspects or as alternative attribute > syntax instead of wasting it for helpers that are defined to work based on > the type > +1 :))) so we have nice topic to talk. I have ho

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 14:50 schrieb "Stefan Glienke" : > > > For generics the only way to support them is that you must explicitly specialize a generic helper type. The compiler won't do any type inference for you. > > IMO this makes them rather useless. Is that a technical limitation or just something you

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 14:41 schrieb "Maciej Izak" : > > 2017-09-01 14:30 GMT+02:00 Michael Van Canneyt : >>> >>> >>> No, directives won't be abused for something like that. >> >> >> I am glad I am not the only one who thins so :) > > > I like experiments as you know. Thanks for critical words as always :P.

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Stefan Glienke
> For generics the only way to support them is that you must explicitly > specialize a generic helper type. The compiler won't do any type inference > for you. IMO this makes them rather useless. Is that a technical limitation or just something you did not want to do? I don't know much about co

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Maciej Izak
2017-09-01 14:30 GMT+02:00 Michael Van Canneyt : > >> No, directives won't be abused for something like that. >> > > I am glad I am not the only one who thins so :) I like experiments as you know. Thanks for critical words as always :P. But this time I must agree too. :) Only one experimental op

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Michael Van Canneyt
On Fri, 1 Sep 2017, Sven Barth via fpc-devel wrote: Am 01.09.2017 12:15 schrieb "Maciej Izak" : 2017-09-01 11:41 GMT+02:00 Stefan Glienke : {$EXPLICITHELPERS TH1, default for string} s.foo; // TH1.foo s.foo1; s.foo2; s.foo3; end. No, directives won't be abused for something like t

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 12:15 schrieb "Maciej Izak" : > > 2017-09-01 11:41 GMT+02:00 Stefan Glienke : >> >> Again you will cause unnecessary headaches because now your helper has the dependency of the builtin and the third party one. >> How would third party one and third party two implement them? They both

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 11:51 schrieb "Stefan Glienke" : > > What I am lobbying for in Delphi are interface helpers and helpers for generic types in general. > > I just saw that FPC currently has the same limitation. That also on your list? > Interface helpers are implemented in trunk for around two weeks n

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Stefan Glienke
I consider that as terribly hard to maintain code. As soon as you move around statements, refactor things everything gets messed up. No thanks. > On 01 September 2017 at 12:15 Maciej Izak wrote: > > > 2017-09-01 11:41 GMT+02:00 Stefan Glienke : > > > Again you will cause unnecessary headaches

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Ondrej Pokorny
On 01.09.2017 12:15, Maciej Izak wrote: 2017-09-01 11:41 GMT+02:00 Stefan Glienke >: Again you will cause unnecessary headaches because now your helper has the dependency of the builtin and the third party one. How would third party one and third party two

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Maciej Izak
2017-09-01 11:41 GMT+02:00 Stefan Glienke : > Again you will cause unnecessary headaches because now your helper has the > dependency of the builtin and the third party one. > How would third party one and third party two implement them? They both > probably would extend the builtin one. Which one

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Ondrej Pokorny
On 01.09.2017 11:41, Stefan Glienke wrote: Again you will cause unnecessary headaches because now your helper has the dependency of the builtin and the third party one. Not really, if you want to use both helpers (builtin and 3rd party) in the same unit you have the dependencies already added

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Stefan Glienke
What I am lobbying for in Delphi are interface helpers and helpers for generic types in general. I just saw that FPC currently has the same limitation. That also on your list? > On 01 September 2017 at 11:07 Sven Barth wrote: > > > Am 01.09.2017 08:47 schrieb "Stefan Glienke" : > > Therefor

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Stefan Glienke
Again you will cause unnecessary headaches because now your helper has the dependency of the builtin and the third party one. How would third party one and third party two implement them? They both probably would extend the builtin one. Which one can you use in your code then? Yes, the one that c

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Sven Barth via fpc-devel
Am 01.09.2017 08:47 schrieb "Stefan Glienke" : > Therefor I argue that the "only the last one in scope is applied" restriction should be removed. > If there are any clashes because two helpers introduce a any ambiguity well then it is the compilers job to warn or error about those and provide a way

Re: [fpc-devel] Allow record helper inheritance in Delphi mode

2017-09-01 Thread Ondrej Pokorny
On 01.09.2017 8:47, Stefan Glienke wrote: Inheritance seems like the obvious way but you just defer the "I cannot extend the builtin helpers" problem. If any third party code decides to do so you are at the same point again because now do you inherit from the third party helper or from the buil