The compiler is supposed to know that after 'case' test one of
branches is impossible and automatically coerce to the other.
That sounds similar to the fact that in a construction like
if Dom has SomeCat then
THEN_BODY
else
ELSE_BODY
Aldor will augment Dom inside THEN_BODY to
Ralf,
I think the semantics of union and case are quite clear (provided of
course that the types in the union are unique). It seems fine to me
to read u case A as telling me explicitly that in the body of this
condition u *is* A.
For the purposes of writing self-documenting easy to read code
For the purposes of writing self-documenting easy to read code perhaps
f(u: Union(A, B)): String
u case A = u.x
u.case B = u.x
Of course this
might be preferable but it seems to me that in this example explicit
coercions such as
f(u: Union(A, B)): String
u case A
Ralf Hemmecke wrote:
Hello,
In src/algebra/intrf.spad.pamphlet are functions like
primintfldpoly(p, extendedint, t') ==
(u := primintegratepoly(p, extendedint, t')) case UPUP = failed
u.a0 ~= 0 = failed
u.answer
that fail when compiled with
)boot $$noEarlyMacroexpand :=