Do you know any programming language features that help to detect bugs early in the software development process - ideally at compile-time or else as early as possible at run-time?
Examples of well-known and effective bug-reducing features are:
- Static typing and generic types: type incompatibility errors are detected by the compiler
- Design by Contract (TM), also called Contract Programming: invalid values are quickly detected at runtime (through preconditions, postconditions and class invariants)
- Unit testing
I ask this question in the context of improving an object-oriented programming language (called Obix) which has been designed from the ground up to 'make it easy to quickly write reliable code'. Besides the features mentioned above this language also incorporates other Fail-fast features such as:
- Objects are immutable by default
- Void (null) values are not allowed by default
The aim is to add more Fail-fast concepts to the language. If you know other features which help to write less error-prone code then please let us know. Thank you.