Very nice on both! I've long had an affinity for non-mainstream programming languages (mostly those with Wirth lineage). I wish there were more projects that used them.
1 point by andreamancuso 0 minutes ago | next | edit | delete [–]
Good point, but there’s a key difference between what abstract base classes or protocols enforce and what this proposal aims to do.
- Abstract Base Classes (ABCs) and Protocols help define interfaces and ensure that methods are implemented, but they don't automatically ensure object consistency across the class. They focus on the shape of objects, not the correctness of their internal state over time.
- This proposal for class invariants would enforce state consistency automatically after every method call, regardless of what methods are defined in the class. It’s more about ensuring that the internal state of the object is always valid (like Balance >= 0) without requiring explicit checks after every method.
As for decorators: Yes, they could technically enforce invariants, but the key point here is consistency and minimal friction. Using a decorator still requires you to opt in manually, and can lead to potential mistakes, especially when inheritance or metaclasses are involved. The goal of this proposal is to provide an explicit, built-in way to define and enforce invariants, without needing a decorator for every class or method.
XFrames is an open source library that is meant to facilitate cross-platform, GPU-accelerated GUI development in the browser and in native Node.js applications - no DOM, no CSS.
It runs, through native prebuilt modules, on Windows, Linux, Raspberry Pi. Once I get my hands on a Mac, I'll build it for Apple silicon too.
It's early days, but early feedback would be highly appreciated.
It's hard to juggle between the two.
[1] https://beyond-tabs.com [2] https://github.com/andreamancuso/rivar-lang