Do you know if it is planned to implement such feature.
Does this sound good for you to be implemented.
This feature is called “result covariance” and FPC supports it for types that directly inherit from one another (e.g. classes), but for interface vs. implementing class this would not be possible (as
marcov said), because classes are not reference counted but interfaces are (at least by default), thus the result would be handled differently, but calling code would not handle that correctly. In Java that is no problem due to the internal structure of the JVM, but in a language like Pascal it is.
Does this sound good for you to be implemented.
For me it is really helpful. I use it a lot in java
It is not clear to me yet how this can be useful.
You can make clear to users of the type that your function will always return a specfic subtype. E.g. imagine a virtual method returning
TStrings and have a sub class that changes the result type to be
TStringList, so it will be clear that this sub class will
at least return descendant of
TStringList (and yes, FPC supports that).