Re: [fpc-devel] Functors

2022-05-26 Thread Sven Barth via fpc-devel
Am 26.12.2021 um 02:16 schrieb Blaise--- via fpc-devel: Important design points: 1) Applying round brackets to instances does not collide with the existing syntax; 2) Naturally, helpers are able to turn helpees into functors; 3) Operator () cannot be applied to types -- that would clash with e

Re: [fpc-devel] Functors

2021-12-26 Thread Ryan Joseph via fpc-devel
> On Dec 27, 2021, at 1:44 AM, bla...@blaise.ru wrote: > > So, in your book, introducing a /new/ operator identifier "doesn't present > any new syntax" (and I agree), but semantically allowing the /existing/ > directive DEFAULT to appear in the existing list of method directives is > somehow

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 27.12.2021 3:14, Martin Frb wrote: it enables you to skip writing the name of the method that is called? anything you can do with it, you can already do without it I am truly flabbergasted at how this could possibly be unclear still. Michael have already asked exactly the same questions in

Re: [fpc-devel] Functors

2021-12-26 Thread Martin Frb via fpc-devel
On 27/12/2021 00:18, bla...@blaise.ru wrote: On 27.12.2021 0:57, Martin Frb via fpc-devel wrote: writeln( aC(33) ); aC('hello'); the above examples are probably intended to show the syntax. But not indented to show any useful application? The test you quoted demonstrates what is alrea

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 27.12.2021 0:57, Martin Frb via fpc-devel wrote: writeln( aC(33) ); aC('hello'); the above examples are probably intended to show the syntax. But not indented to show any useful application? The test you quoted demonstrates what is already possible, syntactically and semantically,

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 27.12.2021 0:03, Michael Van Canneyt via fpc-devel wrote: On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: On 26.12.2021 19:33, Michael Van Canneyt via fpc-devel wrote: On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: following your reasoning, the same should be said about overloading

Re: [fpc-devel] Functors

2021-12-26 Thread Martin Frb via fpc-devel
On 26/12/2021 02:16, Blaise--- via fpc-devel wrote: I propose that the support for https://en.wikipedia.org/wiki/Function_object be added to the FPC. ... begin aC := C.Create; writeln( aC(33) ); aC('hello'); I might be barging in a bit late. But (within the given set that we have

Re: [fpc-devel] Functors

2021-12-26 Thread Michael Van Canneyt via fpc-devel
On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: On 26.12.2021 19:33, Michael Van Canneyt via fpc-devel wrote: On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: On 26.12.2021 11:50, Michael Van Canneyt via fpc-devel wrote: None of what is shown below cannot be handled by ordinary metho

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 26.12.2021 23:47, Blaise--- via fpc-devel wrote: ---8<--- type R = record procedure Foo(...); operator (); function Bar(const A, B: R): R; operator +; end; ---8<--- Made a blunder there, sorry: for Bar, it should either be function Bar(const Other: R): R; op

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 26.12.2021 19:33, Michael Van Canneyt via fpc-devel wrote: On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: On 26.12.2021 11:50, Michael Van Canneyt via fpc-devel wrote: None of what is shown below cannot be handled by ordinary methods Well, yes. But, following your reasoning, the same

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 26.12.2021 17:40, Ryan Joseph via fpc-devel wrote: I'm 99% certain using the method name "Invoke" would be rejected on the grounds of backwards compatibility. Not to argue for the "procedure/function Invoke" syntax, but it hardly breaks backward compatibility. Only in the purest non-practi

Re: [fpc-devel] Functors

2021-12-26 Thread Michael Van Canneyt via fpc-devel
On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: On 26.12.2021 11:50, Michael Van Canneyt via fpc-devel wrote: Please explain what's the point or benefit of this. Do you mean "in general", or "specifically to FPC"? A) In general: I reckon that the article covers the matter quite well; I

Re: [fpc-devel] Functors

2021-12-26 Thread Michael Van Canneyt via fpc-devel
On Sun, 26 Dec 2021, Ryan Joseph via fpc-devel wrote: On Dec 26, 2021, at 3:50 PM, Michael Van Canneyt via fpc-devel wrote: I think the idea of using a fixed member identifier for special purposes is really stupid design. I'll never forgive Embarcadero their 'GetEnumerator' idea... I'

Re: [fpc-devel] Functors

2021-12-26 Thread Ryan Joseph via fpc-devel
> On Dec 26, 2021, at 3:50 PM, Michael Van Canneyt via fpc-devel > wrote: > > Please explain what's the point or benefit of this. To aid in the usage of classes that have the sole intent of being called. Surely though the compiler team will say this is not *needed* and can be achieved using

Re: [fpc-devel] Functors

2021-12-26 Thread Ryan Joseph via fpc-devel
> On Dec 26, 2021, at 3:50 PM, Michael Van Canneyt via fpc-devel > wrote: > > I think the idea of using a fixed member identifier for special purposes is > really > stupid design. I'll never forgive Embarcadero their 'GetEnumerator' idea... I'm 99% certain using the method name "Invoke" woul

Re: [fpc-devel] Functors

2021-12-26 Thread Blaise--- via fpc-devel
On 26.12.2021 11:50, Michael Van Canneyt via fpc-devel wrote: Please explain what's the point or benefit of this. Do you mean "in general", or "specifically to FPC"? A) In general: I reckon that the article covers the matter quite well; I have nothing to add. B) Specifically for FPC: it is up

Re: [fpc-devel] Functors

2021-12-26 Thread Michael Van Canneyt via fpc-devel
On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote: I propose that the support for https://en.wikipedia.org/wiki/Function_object be added to the FPC. Please explain what's the point or benefit of this. None of what is shown below cannot be handled by ordinary methods, and I find the resulti

[fpc-devel] Functors

2021-12-25 Thread Blaise--- via fpc-devel
I propose that the support for https://en.wikipedia.org/wiki/Function_object be added to the FPC. A subset of such functionality already existed as a part of my implementation of closures, so I extended that part to implement the core feature for allowing functors -- overloading of the call op