rhombus-prototype icon indicating copy to clipboard operation
rhombus-prototype copied to clipboard

Unify srcloc

Open sorawee opened this issue 6 years ago • 2 comments

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.

sorawee avatar Aug 11 '19 06:08 sorawee

A few days ago, I was surprised that there is no syntax->srcloc function.

gus-massa avatar Aug 11 '19 16:08 gus-massa

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

AlexKnauth avatar Aug 11 '19 17:08 AlexKnauth