Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-15 Thread Thaddy de Koning
Isn't that exactly what is done in C++? It is prepared in library code. On 10/14/2014 12:40 PM, Marco van de Voort wrote: I recently had to dive a bit into C++ again, and reconnected with a feature I liked at first sight, the C++ covariance of virtual methods (changing the return type of a

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Sven Barth
Am 14.10.2014 12:41 schrieb Marco van de Voort mar...@stack.nl: I recently had to dive a bit into C++ again, and reconnected with a feature I liked at first sight, the C++ covariance of virtual methods (changing the return type of a overriden method to a descendant of the original type).

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Marco van de Voort
In our previous episode, Sven Barth said: At least at first sight there don't seem to be any real (technical) reasons to not covariance for return values. Parameters would be a different topic though... Specially since afaik we can't overload on returnvalue and require override, so there is no

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Jonas Maebe
On 14 Oct 2014, at 14:21, Sven Barth wrote: At least at first sight there don't seem to be any real (technical) reasons to not covariance for return values. Delphi and/or FPC already support it to a certain extent, and the compiler contains some code for it (see

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Flávio Etrusco
On Tue, Oct 14, 2014 at 7:40 AM, Marco van de Voort mar...@stack.nl wrote: I recently had to dive a bit into C++ again, and reconnected with a feature I liked at first sight, the C++ covariance of virtual methods (changing the return type of a overriden method to a descendant of the original

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Hans-Peter Diettrich
Sven Barth schrieb: At least at first sight there don't seem to be any real (technical) reasons to not covariance for return values. Parameters would be a different topic though... Just so I get the idea right: === code begin === type TBar = class function Test: TObject; virtual;

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Sven Barth
On 14.10.2014 15:34, Jonas Maebe wrote: On 14 Oct 2014, at 14:21, Sven Barth wrote: At least at first sight there don't seem to be any real (technical) reasons to not covariance for return values. Delphi and/or FPC already support it to a certain extent, and the compiler contains some code

Re: [fpc-devel] suggestion: virtual method co-variance

2014-10-14 Thread Sven Barth
On 15.10.2014 04:21, Hans-Peter Diettrich wrote: Sven Barth schrieb: At least at first sight there don't seem to be any real (technical) reasons to not covariance for return values. Parameters would be a different topic though... Just so I get the idea right: === code begin === type TBar