On Sat, Dec 27, 2014 at 1:06 PM, David Jeske <[email protected]> wrote:
> Whole program compilers don't have this problem, because everything is
> statically known at compile-time. Consider a simple Ocaml match example.
>
> type expr_t =
> | Var of string
> | Plus of expr_t * expr_t
>
> let rec str_of_expr expr =
> match expr with
> | Var v -> v
> | Plus (a, b) ->
> "(" ^ (str_of_expr a) ^ "+" ^ (str_of_expr b) ^ ")"
>
> OCaml knows this match is exhaustive is because the form of expr_t is
> bound at compile time. If expr_t were defined in a separate module...
>
Except, of course, that if the (static) type of expr_t wasn't known in this
module, you couldn't have written a decomposing pattern match at all!
All of the examples I can come up with along the lines you describe involve
open unions (in C#: inheritance).
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev