Rewrite atom interpolations - non keywords#15531
Conversation
josevalim
left a comment
There was a problem hiding this comment.
Looks good to me. My only concern is that the migrate_atom_interpolation will push everyone to Elixir v1.21 but given migration is opt-in, we are likely fine!
That's a good point, this wouldn't be useful as is for library authors yet (which is probably where atom interpolations was the most used). The keyword migration also happens to be more tricky than expected. We cannot only change the key-value pair locally, we need to change preceding keys too otherwise we might get an invalid pair. |
Since we are soft-deprecating the
:"foo#{x}"in favor ofString.to_unsafe_atom/1, I figured I'd rewrite these in the codebase already.I added a new
migrate_atom_interpolationsformatter option to perform this (first commit).We don't have to keep it though if we don't want to, I wanted this for myself and figured it might help people address this deprecation more easily (which is the point of
--migrate).If we want to indeed support the option, will add proper tests and support for keywords as well, I wanted to get feedback first.