Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
On 23.08.2017 20:38, Marcos Douglas B. Santos wrote: > On Wed, Aug 23, 2017 at 3:25 PM, Sven Barth via fpc-pascal > wrote: >> On 23.08.2017 19:57, Marcos Douglas B. Santos wrote: >>> Would we have any problem of memory leaks using Interface helper with >>> COM

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 3:25 PM, Sven Barth via fpc-pascal wrote: > On 23.08.2017 19:57, Marcos Douglas B. Santos wrote: >> Would we have any problem of memory leaks using Interface helper with >> COM interfaces (refcount)? >> I mean, the "type helper" has

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
On 23.08.2017 19:57, Marcos Douglas B. Santos wrote: > On Wed, Aug 23, 2017 at 2:45 PM, Sven Barth via fpc-pascal > wrote: >> Am 23.08.2017 19:39 schrieb "Marcos Douglas B. Santos" : >>> >>> Wait a minute. Now I realize that procedure

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 16:01 schrieb "Anthony Walter" : > > As to what they are useful for, consider the following: > > type > // IShellLink is define by Microsoft > IShellLinkHelper = record helper for IShellLink > public > procedure Save(const Target, Description, Link:

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 19:40 schrieb "Anthony Walter" : > > Sven, multiple helpers would be greatly appreciated, especially considering everyone wants to add their own helpers for types like string. At least in FPC modes they can use inheritance to solve this (see below) or by putting

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 19:39 schrieb "Marcos Douglas B. Santos" : > > On Wed, Aug 23, 2017 at 11:00 AM, Anthony Walter wrote: > > Marco, it doesn't work that way. > > > > Type helpers simply allow you to extend an existing type with new methods > > and/or properties.

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Anthony Walter
Sven, multiple helpers would be greatly appreciated, especially considering everyone wants to add their own helpers for types like string. Thanks again! ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 11:00 AM, Anthony Walter wrote: > Marco, it doesn't work that way. > > Type helpers simply allow you to extend an existing type with new methods > and/or properties. When you declare a type helper you extend all instances > of said type given that: > > A)

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 12:13 PM, Sven Barth via fpc-pascal wrote: > Am 23.08.2017 16:58 schrieb "Marcos Douglas B. Santos" : >> >> Is this compatible with Delphi? > > Interface helpers are only supported by FPC. But the other helpers (class, >

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 16:01 schrieb "Anthony Walter" : > > Marco, it doesn't work that way. > > Type helpers simply allow you to extend an existing type with new methods and/or properties. When you declare a type helper you extend all instances of said type given that: > > A) You 'use'

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 16:59 schrieb "Marcos Douglas B. Santos" : > > On Wed, Aug 23, 2017 at 11:07 AM, Anthony Walter wrote: > > Here is another example: > > > > type > > TDay = (Monday = 0, Tuesday, Wednesday, Thursday, Friday, Saturday, > > Sunday); > > > >

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 16:58 schrieb "Marcos Douglas B. Santos" : > > On Wed, Aug 23, 2017 at 11:00 AM, Anthony Walter wrote: > > Marcos, it doesn't work that way. > > > > Type helpers simply allow you to extend an existing type with new methods > > and/or properties.

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 11:07 AM, Anthony Walter wrote: > Here is another example: > > type > TDay = (Monday = 0, Tuesday, Wednesday, Thursday, Friday, Saturday, > Sunday); > > TDayHelper = record helper for TDay > function AsByte: Byte; > function ToString: string;

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 11:00 AM, Anthony Walter wrote: > Marcos, it doesn't work that way. > > Type helpers simply allow you to extend an existing type with new methods > and/or properties. When you declare a type helper you extend all instances > of said type given that: > >

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Anthony Walter
Here is another example: type TDay = (Monday = 0, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); TDayHelper = record helper for TDay function AsByte: Byte; function ToString: string; end; function TDayHelper.AsByte: Byte; begin Result := Ord(Self); end; function

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Anthony Walter
Marco, it doesn't work that way. Type helpers simply allow you to extend an existing type with new methods and/or properties. When you declare a type helper you extend all instances of said type given that: A) You 'use' the unit declaring the type helper in some other unit. B) No other unit

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Marcos Douglas B. Santos
On Wed, Aug 23, 2017 at 6:18 AM, Sven Barth via fpc-pascal wrote: > Am 23.08.2017 09:42 schrieb "Michael Van Canneyt" : >> >> >> Any other examples ? > > It's the same as for the other kinds of helpers: being syntactic sugar. > E.g. if I

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 09:42 schrieb "Michael Van Canneyt" : > > > > On Tue, 22 Aug 2017, Anthony Walter wrote: > >> I just wanted to point out that revision 37023 Sven added type helper >> support for interfaces. >> >> Good job and thank you Sven! >> > > I'm having trouble

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Michael Van Canneyt
On Tue, 22 Aug 2017, Anthony Walter wrote: I just wanted to point out that revision 37023 Sven added type helper support for interfaces. Good job and thank you Sven! I'm having trouble understanding why this could be useful (apart from completeness). The only thing I can come up with is

Re: [fpc-pascal] Check In Interface Type Helpers

2017-08-23 Thread Sven Barth via fpc-pascal
Am 23.08.2017 02:04 schrieb "Anthony Walter" : > > I just wanted to point out that revision 37023 Sven added type helper support for interfaces. > > Good job and thank you Sven! You're welcome. I wanted to add them for some time already :) Regards, Sven