[fpc-pascal] Generics in Objective Pascal?
Ryan Joseph
genericptr at gmail.com
Mon Nov 2 22:37:48 CET 2020
> On Nov 2, 2020, at 1:30 PM, Zoƫ Peterson via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> I have an NSView subclass with a bunch of fields and methods, and I wanted to be able to optionally swap that out with a parallel version derived from NSVisualEffectView without duplicating all of the code. I was hoping that adding generics to objcclass would be relatively trivial and just hadn't been asked for, but I know how assuming that usually goes.
Hmmm It sounds like once again Pascal needs "traits" or some other way to do composition? I'm extremely keep to develop such feature if the team wouuld decide on some syntax and principles (I had a thread about this some months ago if you search).
In mean time I guess you could try include files and ifdefs in some clever way. Not pretty but maybe it's better then keeping lots of duplicated code or doing big refactors.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list