2024-03-09

  • One of the main benefits of static/strong/strict typing is that you know the shape of your data when writing code. And with the information about the shape of the data, you avoid some pretty common/annoying programming errors, like thinking a field is present when it isn’t or making a small typo when accessing a field. It’s very nice to catch these types of errors before executing the code. But today, I was thinking about alternatives to using types to get this information when writing code. And I realized that you could, in theory, get a similar amount of value if you had really good data from existing/prior executions of the program. In theory (and some debuggers do this ofc), your program could monitor inputs/outputs for some fraction of the executions of every function in your codebase, recording the names of arguments, instance fields, etc. And then you could make that information downloadable/accessible in an editor. A programmer could hover over a function argument and see something like

Date
March 9, 2024