@assert seems like a pretty useless macro right now.
Here are some plausible uses for @assert
- Input validation in a public-facing function
- Check invariants in the middle of an algorithm to give errors if the programmer made a mistake
a. When small constant factors do matter
b. When small constant factors do not matter
- Give the compiler a hint that a statement is true to improve performance.
Right now @assert is only useful in 2.b.
@assertseems like a pretty useless macro right now.Here are some plausible uses for
@asserta. When small constant factors do matter
b. When small constant factors do not matter
Right now
@assertis only useful in 2.b.