compile time assertions #1282
waalge
started this conversation in
Core language features
Replies: 1 comment 1 reply
|
This isn't possible in this form at the moment. One current alternative is to use environments for it; For example you can define:
pub fn assert_non_positive(n: Int) -> n {
expect n <= 0
n
}
pub fn assert_non_positive(n: Int) -> n {
n
} And in the rest of the code, use I've moved the ticket as a discussion for now. As this seem like an interesting language feature but needs to be refined and scoped accordingly before we act on it. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to get aiken to do a compile time assert?
This doesn't work - aiken ignores this entirely.
Using is_exp_non_positive causes an ungraceful exit.
But something like this?
All reactions