Open AutonomicPerfectionist opened 1 year ago
CMakePPLang is modeled after Python, which also supports extension methods/attributes. I don't foresee us changing how classes are implemented in CMakePPLang, so I think we may as well make this a supported feature, especially since we get it more or less for free.
Is your feature request related to a problem? Please describe. It seems that CMakePPLang classes support a feature called "extension attributes/methods" in other languages like Kotlin or C#. The feature allows external parties to define additional methods and attributes on a class outside of the
cpp_class
/cpp_end_class
fences. I believe support for this feature is merely a byproduct of how classes were implemented, but nevertheless, I could not find any documentation on it.Example usage:
Describe the solution you'd like I think it would be wise to at least document the current ability to use extension attributes/methods, perhaps adding that such usage is unstable and not guaranteed to work in future versions unless we desire to officially support them. Otherwise, it might be a good idea to explicitly disallow them, which can be done by "freezing" a class's definition upon calling
cpp_end_class()
.This issue is very low priority, mainly I'm just writing it down because I made the observation and wondered if such usage was officially supported or not.