Stream: platform development

Topic: source location


view this post on Zulip Brian Hicks (Aug 31 2022 at 21:08):

is there a way to get a source location for various structures? For rbt especially, I'd like to say things like "the value you passed has such-and-such a characteristic, but that's not allowed!" along with the source location to fix things. Since rbt targets don't have human-usable names, the source location would be really nice!

view this post on Zulip Richard Feldman (Aug 31 2022 at 21:15):

as in get it at runtime in running Roc code?

view this post on Zulip Brian Carroll (Aug 31 2022 at 21:18):

Are you talking about getting compiler errors as JSON instead of text? I don't think we have that at the moment.
Or you could import the compiler into rbt as a Rust crate and run the parser and type checker.

view this post on Zulip Brian Hicks (Aug 31 2022 at 21:43):

I mean getting it at runtime! It doesn't seem like it's super possible, but I thought I'd ask.

view this post on Zulip Brian Hicks (Aug 31 2022 at 21:44):

I'm also gonna need to eventually get the path to the entrypoint file (and probably establish that there can only be one of those) to calculate paths relative to a root, so it's probably gonna be necessary to wrap the compiler in some way, even if it's only invoking the CLI.


Last updated: Jul 05 2025 at 12:14 UTC