Giving Types to JQ: A Benign Type Inference Procedure
Jq is a powerful tool for manipulating JSON data, allowing users to express complex transformations in a succinct, dynamic, and elegant way. However, when something goes wrong, jq typically produces vague, local error messages that lack the context needed to help users diagnose the issue. In this talk, I’ll discuss how we can use static analysis to infer the "shape" of valid JSON inputs, and leverage this information to provide more meaningful, global error messages. This approach doesn’t require type annotations from the user, making it both practical and lightweight. I'll dive into the technical implementation of the inference procedure, the underlying principles, and how this technique could be applied to other languages with similar challenges. By the end of the talk, attendees will gain insights into how shape inference can enhance error handling in dynamically typed programming languages.