Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Sven Barth via fpc-pascal
Am 14.02.2021 um 19:03 schrieb Ryan Joseph via fpc-pascal: What it leaves desired: 1) Making a dummy interface is annoying boiler plate but not a deal breaker. Again, I see this is part of Pascal's declarativeness. Also this way you can make sure that only those methods/properties that you

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Marco van de Voort via fpc-pascal
Op 2021-02-14 om 17:16 schreef Michael Van Canneyt via fpc-pascal: except it doesn't require an interface. The thing we seem to want here is a default property which works on records/objects so maybe we can just focus on that? The interface has so much boiler plate and I don't really see

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Marco van de Voort via fpc-pascal
Op 2021-02-14 om 13:30 schreef Michael Van Canneyt via fpc-pascal: I think the "performance implications" is more referring to memory management. Interfaces means an extra object per interface, so more objects on the heap with all the extra memory management that implies. (not interfaces

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 14, 2021, at 11:14 AM, Sven Barth via fpc-pascal > wrote: > > It's a runtime conversion, but normally you don't do the conversion for every > method call, but instead cache the interface (or work solely with the > interface), thus the performance impact through the conversion

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Sven Barth via fpc-pascal
Am 14.02.2021 um 19:07 schrieb Ryan Joseph via fpc-pascal: On Feb 14, 2021, at 9:55 AM, Sven Barth via fpc-pascal wrote: No, interfaces by *themselves* don't mean that. An interface instance is merely a shifted Self pointer that points to the static VMT of which the entries correct the

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 14, 2021, at 9:55 AM, Sven Barth via fpc-pascal > wrote: > > No, interfaces by *themselves* don't mean that. An interface instance is > merely a shifted Self pointer that points to the static VMT of which the > entries correct the Self pointer again upon the method call. This can

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 14, 2021, at 10:20 AM, Sven Barth via fpc-pascal > wrote: > > To be fair, that *is* how inheritance works for example if you try to use OOP > in C... (though it would be more like "sphere.parent.parent.Draw()") and that was bad. :) in PHP you're forced to use this-> instead of

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Martin Frb via fpc-pascal
On 14/02/2021 18:20, Sven Barth via fpc-pascal wrote:    TTest = class(TObject, ITest)    private fTest: TTestImpl;    public property Test: TTestImpl read fTest implements ITest; default;    end; Well there is a difference there. Interfaces are essentially inheritance. One can

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Sven Barth via fpc-pascal
Am 14.02.2021 um 02:45 schrieb Ryan Joseph via fpc-pascal: On Feb 13, 2021, at 12:38 PM, Sven Barth wrote: Right now, Ryan, your suggestion looks like a solution in search of a problem, or a "hey, look at that feature in language X, I so must have that in Pascal as well". Those concepts more

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Michael Van Canneyt via fpc-pascal
On Sun, 14 Feb 2021, Sven Barth via fpc-pascal wrote: Am 14.02.2021 um 13:30 schrieb Michael Van Canneyt via fpc-pascal: On Sun, 14 Feb 2021, Sven Barth via fpc-pascal wrote: So whether it be this, or just an improvement on the Interfaces we already have, I'd definitely personally be in

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Sven Barth via fpc-pascal
Am 14.02.2021 um 13:30 schrieb Michael Van Canneyt via fpc-pascal: On Sun, 14 Feb 2021, Sven Barth via fpc-pascal wrote: So whether it be this, or just an improvement on the Interfaces we already have, I'd definitely personally be in favor of something that "works like Interfaces except

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 14, 2021, at 9:16 AM, Michael Van Canneyt via fpc-pascal > wrote: > > I didn't propose using an interface; For me the > > property Test: TTestImpl read fTest implements TTestIimpl; > > Where TTestImpl is an object (tp style) or advanced record (delphi style) is > ample. That was

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Michael Van Canneyt via fpc-pascal
On Sun, 14 Feb 2021, Ryan Joseph via fpc-pascal wrote: On Feb 14, 2021, at 5:30 AM, Michael Van Canneyt via fpc-pascal wrote: Interfaces means an extra object per interface, so more objects on the heap with all the extra memory management that implies. You mean COM interfaces? I've

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Ryan Joseph via fpc-pascal
> On Feb 14, 2021, at 5:30 AM, Michael Van Canneyt via fpc-pascal > wrote: > > Interfaces means an extra object per interface, so more objects on the heap > with all the extra memory management that implies. You mean COM interfaces? I've only ever used CORBA style ones which I thought were

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Michael Van Canneyt via fpc-pascal
On Sun, 14 Feb 2021, Sven Barth via fpc-pascal wrote: So whether it be this, or just an improvement on the Interfaces we already have, I'd definitely personally be in favor of something that "works like Interfaces except minus the negative performance implications." There are no

Re: [fpc-pascal] Traits Proposal

2021-02-14 Thread Sven Barth via fpc-pascal
Am 14.02.2021 um 01:09 schrieb Ben Grasset via fpc-pascal: This seems possibly a *little* too similar to the existing Interface type in Object Pascal, however, I *would* really like to see some kind of functionality that basically amounts to "has the same capabilities as Interfaces and works