On Thu, Jun 11, 2015 at 11:43 PM, Keean Schupke <[email protected]> wrote:
> What do you mean by a typed AST? > > My point was that in the AST a function node accepts N polymorphic > sub-expressions (one for each argument). You cannot statically type the > number of arguments or the types of each argument... > You cannot statically type the number or arguments because it is variant. You can *certainly* type the argument ASTs: all have type ExprAST. > So all nodes in my AST are subclasses of a generic AST node class, this is > no problem as the nodes need to be polymorphic anyway. > Why do they need to be polymorphic in this way, other than the convenience of common fields like "position"? The point of a typed AST is to impose a finer-grain structure on the tree. > In a functional language I would use a disjoint union for the node type > (as the tag in the disjoint union encodes the necessary runtime > polymorphism). To try and use types to encode this, where you are pushing > runtime polymorphism into the type system... > I'm certainly not pushing runtime polymorphism into the type system. We are clearly talking at cross purposes somehow. The "typed AST" notion I am thinking about is essentially the one described by Appel in his paper on Zephyr. Jonathan
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
