rhombus-prototype
rhombus-prototype copied to clipboard
Unify srcloc
There are multiple representations of source locations (e.g., list, vector, srcloc struct, syntax). Not all of them can be used in functions that expect "source location". For instance, datum->syntax doesn't accept srcloc struct.
My proposal is that there should be only one canonical representation (srcloc struct in particular), but if that's not possible, every function that consumes source location should be consistent and support every representation.
A few days ago, I was surprised that there is no syntax->srcloc function.
The build-source-location function from syntax/srcloc can act as a syntax->srcloc function if you give it a syntax object, although since it can convert from any srcloc representation, perhaps just ->srcloc would be a better name