[fpc-pascal] Multiple active class helpers at same time
ryan at thealchemistguild.com
Mon Apr 23 16:37:28 CEST 2018
> On Apr 23, 2018, at 7:13 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> Yes, it is planned. Main problem currently (aside from time) is to define when a method hides the method of another helper, especially when inheritance (both for the helper and the extended type) is involved.
Probably the best feature of Objective-C (and now Swift) is categories/extensions which are basically class helpers but with no limits on scope like in FPC. I never had problems with naming conflicts and I use them very often to split up large classes and extend library classes. Maybe looking at how “extensions” are implemented in Swift is a good idea? (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Extensions.html)
Btw why in the world did Delphi limit the scope like they did? It’s such a sad shortcoming of a great feature that everyone loves who works in the aforementioned languages. In fact I barely ever use them in FPC because I know if I rely on them too much I could get trapped in a situation where I have a scope conflict and there’s nothing I can do!
More information about the fpc-pascal