In which field order should Str.inspect print a record, same as definition, or alphabetical or something else?
My personal preference would be same as definition, but I wouldn't pitch a fit about alphabetic order lol.
same order as definition is what i would expect as a user. but if they get sorted then changing the order of the fields probably can't be a breaking change :thinking:
same order is tricky
I think it has to be alphabetical for anonymous records (although nominal can use definition)
I think to get it same order we'd need to change type unification to have aliases unify with records in a way where the alias's order "wins"
but the problem there is that now you can potentially have multiple aliases unifying successfully with the same record, so you need a way to decide which one wins
at which point you can get into territory of running the same build twice and getting a different program based on thread race conditions etc.
so I think it's better to just go with alphabetical for anonymous records
for nominal records definition should be no problem
same order might be hard in general, because unification must sort records fields alphabetically (so it knows which fields belong to record a, which to record b, and which are in both, then has those groups “flow” into the records extensible variables)
oh yeah also true
Last updated: May 23 2026 at 12:51 UTC