The way we're thinking about breaking changes is really silly

20 points by kylewlacy


BenjaminRi

In practice, what this means is that we essentially don’t directly allow changing a function’s type ever.

As someone who has written and interacted with way too many APIs over the years: This is a feature, not a bug. I am happy that this is the case.

Unfortunately, union types break parametricity and have pretty poor nesting behavior

This is only the case for TypeScript, because it automatically flattens null. Languages with a more rigorous type system, like Haskell or Rust, are not subject to this problem. For example, in Rust you can nest Option and then use .flatten() explicitly if you want to get rid of the option nesting.

So how do we prevent old call sites from breaking without having to keep supporting the exact way they were called into all eternity? Migrations!

Exactly. And the migration is that you change the name of the function and deprecate the old one, ideally with a generous timeline to make it easier for everyone to deal with this change - which might in practice be automated indeed. I don’t think I would look forward to a future where I have to trawl through migration macros and migration files to understand what my code does. But I do agree with the general sentiment that we could be more rigorous and automate more.