[fpc-pascal] Generics in Objective Pascal?

Ryan Joseph genericptr at gmail.com
Mon Nov 2 20:01:56 CET 2020



> On Nov 1, 2020, at 8:45 AM, Zoƫ Peterson via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> I'd like to have a generic objcclass that would add some extra functionality for multiple base types.  I don't have a lot of experience with generics, but this compiles:
> 

Waiting for Jonas to reply but I'm pretty certain this is a feature never implemented. I've been working with generics in the compiler recently and I don't see any reason why they would be hard to implement but maybe Jonas knows the answer.

What are you trying to do exactly? There are categories in ObjC but those don't allow fields (they're like helpers in Object Pascal). If you need to share data between a bunch of different NSView subclasses then all you can do is make a common subclass or make the shared data a class of its own and pass that into all your subclasses. Nothing ObjC related about that however but I'm not sure what you're trying to do.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list