proposal-binary-ast
proposal-binary-ast copied to clipboard
Validating Babylon ASTs
Even if it's well-typed, Babylon ASTs permit things which are not valid JavaScript syntax (for example, module declarations in scripts). What's the idea for how to validate these ASTs? I suppose, with the "delayed early error" idea, you validate at the function granularity, when the function is actually called; this would include include not just what would be JavaScript early errors, but also anything that would be malformed about the Babylon AST--is that what you had in mind?
Yes, the idea is to make this part of "delayed early error".
Incidentally, part of the reason I recommended Shift is that well-typed Shift ASTs represent far fewer invalid programs than do well-typed Babylon ASTs - and moreover we've enumerated all the ways they can fail to.
Though I'm not sure it's all that much of a win, since presumably you'd still have to typecheck the AST.
@littledan Yeah, that's what we had in mind.