-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Add something like static_assert
, e.g like assert
. Would be similar to something like in lib/assert.gof
(there is an runtime assertions)
Static assertions would fail at compilation time if they not passing
#include "assert.gof"
// This will be compiled down to runtime check
2 3 "2 must equals 2!" runtime_assert
// When we want to introduce something like:
2 3 "2 must equals 2!" static_assert
// Which will never be passed to codegen (e.g compiled)
// but rather emit an check at compilation time, and if it is failing, will raise an error
This is useful for some assertions for constants, like checking is given constant is divisible by 2 (for example assert that width of an window is not less or equals 0)
Questions and caveats:
- Requires mostly of the time CTE (compile-time-evaluation)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request