I searched the Julia language repository (v1.0.3) with “@assert” and found more than 500 cases. It was surprising to me that the released code base has such a large number of @assert statements. According to my understanding, assertion should be carefully used to check only critical cases our programs cannot be recovered from. Otherwise, we need to raise exceptions so that other programs can hopefully handle the cases. Particularly, when a program is released officially after serious tests, all assertions should be passed and deactivated (or removed) to avoid any performance penalty with assertions.
I scanned several @assert statements in Julia and found some of them can be just removed (or deactivated) before a release or should be replaced by throw(SomeException).
Is there any particular reason I don’t know why the Julia language codebase still has more than 500 @assert statements in the official releases?