Skip to content

Comment on Access Control in Swiftparent

Comments

IMHO multiple inheritance is a bad solution to this problem. I would be more inclined to use a DI pattern and inject an event manager wherever it's needed.

Even when multiple inheritance is genuinely useful, it still feels dirty to me. PHP actually has a nice feature called traits, which is essentially compiler-assisted copy & paste. It means you can re-use code without duplication and without the confusion that multiple inheritance can bring.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.