Hello, all. On one or two occasions I've encountered a problem when designing a base class, where I wish to implement important set-up functionality in the constructor, but am limited in how to ensure that the base constructor functionality is unmolested whilst not restricting any inheriting classes in their use of a constructor, as would be the case when using the final keyword. I also don't feel 100% comfortable trusting the inheriting class to call the parent constructor.
The idea I'm presenting for discussion here is to have some kind of (keyword-driven?) hierarchy for constructors, whereby it's possible to have for example sequential constructors, using syntax similar to: ... public sequential function __construct($ ... In this scenario, constructors defined as sequential are, as the name implies, called in sequence. If the introduction of a new keyword is problematic, perhaps this same behaviour could be enacted in cases where an inheriting class has a constructor and the base class' constructor is defined as final i.e. rather than causing an error, the final constructor is executed first, followed by any other constructors in the hierarchy. If this keyword is introduced, perhaps it this idea could also be expanded to allow for sequential methods in general, which would behave similarly - and may be a gateway to function overloading (or similar behaviour). I'm open to people pointing out design flaws/implementation difficulties with this; pull no punches. Thanks.