Because — as in Erlang — the semicolon is a separator, and the expression's value does not go through it? So the type of `a` is A, but the type of `a;` is Unit.
You meant semicolon is used as a binary operator, joining the statements into one long expression. Since it's an operator, its behavior can be defined to however make sense. Why not just say in the absence of the right operand, return the result of the left operand? Just like || (or) can return the result of left or right operand.
So type of 'a' is A. Type of 'a;b' is B. Type of 'a;' is A.
Ok, I see. I guess it's like the comma in other languages delimiting the terms in a list expression, (a, b, c), where the last term is returned as the result of the expression. But what's the difference between a separator and an operator? Both of them define certain semantic. In the Erlang case, the semicolon evaluates two operands and returns the right term, just like a binary operator.
What I'm trying to say is there is no one right way to define an operator/separator behavior. It's entirely upto the language design. One can define the missing last term to be omitted completely. E.g. (a , b , c , ) could return c. And { s1 ; s2 ; s3 ; } could return s3.
Edit: Ok, I didn't know Erlang. Apparently semicolon is same as the OR operator in the case statement, not as a sequencing operator like comma.