If we can pre-define the types via something like this:

data Tree a = Branch (Tree a) (Tree a) | Leaf a


And only allow one type for each function parameter in the prototype, then,
I think the performance impact of type checking in the runtime can be
reduced.

In other words, you predefine the union type before you used them, and the
union types can be reused in different functions, you don't write a lot
union type in function prototype.

For example,

   typedef T = array | Traversable

   function foo(T $a) {  }
   function bar(T $b) {  }

Reply via email to