Re: [fpc-pascal] Managed properties idea

2017-10-09 Thread Marcos Douglas B. Santos
On Mon, Oct 9, 2017 at 3:54 PM, Maciej Izak wrote: > 2017-10-09 14:43 GMT+02:00 Marcos Douglas B. Santos : >> >> This TAutoFree just "put" the "finally" and call .Free for an array of >> objects or does it something else? >> Could you send the link of the implementation? > > > "One" and "Several"

Re: [fpc-pascal] Managed properties idea

2017-10-09 Thread Maciej Izak
2017-10-09 14:43 GMT+02:00 Marcos Douglas B. Santos : > This TAutoFree just "put" the "finally" and call .Free for an array of > objects or does it something else? > Could you send the link of the implementation? > "One" and "Several" returns IAutoFree interface. Implementation of that interface

Re: [fpc-pascal] Managed properties idea

2017-10-09 Thread Marcos Douglas B. Santos
On Mon, Oct 9, 2017 at 5:24 AM, Maciej Izak wrote: > 2017-10-07 2:10 GMT+02:00 Michalis Kamburelis : >> >> [...] > > mORMot framework has also nice solution for "auto free" (solution uses > interfaces too): > > ===code begin=== > with TAutoFree.One(o, TObject.Create) do > begin > ... >

Re: [fpc-pascal] Managed properties idea

2017-10-09 Thread Maciej Izak
2017-10-07 2:10 GMT+02:00 Michalis Kamburelis : > Your TSmartObj is, well, exactly what I want:) As long as you pass > around only "TSmartObj" (and don't create cycles :) ), > you're perfectly safe and leak-free. > Probably management operators idea will be expanded by new operators Clone & Assig

Re: [fpc-pascal] Managed properties idea

2017-10-07 Thread Sven Barth via fpc-pascal
Am 07.10.2017 17:15 schrieb "Marcos Douglas B. Santos" : > > On Fri, Oct 6, 2017 at 4:17 PM, Sven Barth via fpc-pascal > wrote: > > Am 06.10.2017 20:52 schrieb "Marcos Douglas B. Santos" : > >> > And reference counting like in e.g. C++ "shared pointers", that can > >> > wrap any > >> > class, wit

Re: [fpc-pascal] Managed properties idea

2017-10-07 Thread Marcos Douglas B. Santos
On Fri, Oct 6, 2017 at 4:49 PM, Michalis Kamburelis wrote: > 2017-10-06 20:52 GMT+02:00 Marcos Douglas B. Santos : > [...] >>> In this case, in which you indeed want two of these features simultaneously, >>> I advise COM interfaces myself :) That's why they are documented after all. >> >> I can us

Re: [fpc-pascal] Managed properties idea

2017-10-07 Thread Marcos Douglas B. Santos
On Fri, Oct 6, 2017 at 4:17 PM, Sven Barth via fpc-pascal wrote: > Am 06.10.2017 20:52 schrieb "Marcos Douglas B. Santos" : >> > And reference counting like in e.g. C++ "shared pointers", that can >> > wrap any >> > class, without any additional feature (in Pascal we may get this with >> > "manag

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Michalis Kamburelis
2017-10-06 23:55 GMT+02:00 Maciej Izak : > ... and here is library with exclusive usage of "management operators" for > FPC: > > https://github.com/pda0/AutoScope > > ... and here is experimental smart pointers/objects/nullable types > implementation: > > https://github.com/maciej-izak/PascalSmartP

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Maciej Izak
2017-10-06 21:17 GMT+02:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: > Am 06.10.2017 20:52 schrieb "Marcos Douglas B. Santos" : > > > And reference counting like in e.g. C++ "shared pointers", that can > wrap any > > > class, without any additional feature (in Pascal we may ge

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Michalis Kamburelis
2017-10-06 21:49 GMT+02:00 Michalis Kamburelis : > 2017-10-06 20:52 GMT+02:00 Marcos Douglas B. Santos : > [...] >>> In this case, in which you indeed want two of these features simultaneously, >>> I advise COM interfaces myself :) That's why they are documented after all. >> >> I can use it only t

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Michalis Kamburelis
2017-10-06 20:52 GMT+02:00 Marcos Douglas B. Santos : [...] >> In this case, in which you indeed want two of these features simultaneously, >> I advise COM interfaces myself :) That's why they are documented after all. > > I can use it only to use reference counting. You can, but it's a little unc

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Sven Barth via fpc-pascal
Am 06.10.2017 20:52 schrieb "Marcos Douglas B. Santos" : > > And reference counting like in e.g. C++ "shared pointers", that can wrap any > > class, without any additional feature (in Pascal we may get this with > > "management operators"). > > I don't know about "management operators". Could you

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Marcos Douglas B. Santos
On Fri, Oct 6, 2017 at 1:06 PM, Michalis Kamburelis wrote: > > 05.10.2017 2:07 PM "Marcos Douglas B. Santos" napisał(a): > > [...] > As Sven told you, just use COM Interfaces. > Look this explanation -> > http://castle-engine.io/modern_pascal_introduction.html#_corba_and_com_types_of_interfaces >

Re: [fpc-pascal] Managed properties idea

2017-10-06 Thread Michalis Kamburelis
05.10.2017 2:07 PM "Marcos Douglas B. Santos" napisał(a): On Thu, Oct 5, 2017 at 5:55 AM, Ryan Joseph wrote: > >> On Oct 5, 2017, at 12:28 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: >> >> The way to go in Object Pascal are reference counted interfaces (aka COM-style

Re: [fpc-pascal] Managed properties idea

2017-10-05 Thread Marcos Douglas B. Santos
On Thu, Oct 5, 2017 at 5:55 AM, Ryan Joseph wrote: > >> On Oct 5, 2017, at 12:28 PM, Sven Barth via fpc-pascal >> wrote: >> >> The way to go in Object Pascal are reference counted interfaces (aka >> COM-style interfaces). After all one should program against an interface >> anyway and that ref

Re: [fpc-pascal] Managed properties idea

2017-10-05 Thread Ryan Joseph
> On Oct 5, 2017, at 12:28 PM, Sven Barth via fpc-pascal > wrote: > > The way to go in Object Pascal are reference counted interfaces (aka > COM-style interfaces). After all one should program against an interface > anyway and that reference counted interfaces are automatically handled by the

Re: [fpc-pascal] Managed properties idea

2017-10-04 Thread Sven Barth via fpc-pascal
Am 05.10.2017 05:04 schrieb "Ryan Joseph" : > I’ve been wanting to learn how to contribute to the compiler for years now but maybe this is an easy enough project to start with. I don’t know if this is a problem people have though but I assume it may be since Objective-C had a system like for memor

[fpc-pascal] Managed properties idea

2017-10-04 Thread Ryan Joseph
Yesterday when I was thinking about that enumerators I had an idea for a language feature and something which I saw introduced in Objective-C some years ago. Retaining of a member variable through a property is a common pattern I do everyday nearly. In my root class I manage a simply retain cou