Remix.run Logo
csb6 3 days ago

Ada doesn’t have pattern matching, so there is no way for it to enforce that only the valid fields are accessed except at runtime (beyond warnings if the discriminant is known at compile time). Most people would just use a case statement that checks the variant discriminant before accessing any fields.

I believe the SPARK subset can (through static analysis) ensure that only valid fields are accessed for the current discriminant.