JSON formatted error output #2339
n-ham
started this conversation in
Language design
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just had the idea that languages in 2022 really ought to give error output in a format that can easily be parsed by other programs (eg. JSON). For example it would make it much easier to back trace error line numbers for anything that builds to c++/carbon (similar to backtracing line numbers for programs that embed Lua(JIT) and other embeddable languages). It would also make it easier to provide varying levels of error output for both the compiler and external tools/programs/libraries.
It's also crossed my mind a few times recently to tinker with the idea of using json, or some other serialisation format (maybe a modified json format, some kind of dag based json would be good) to be used for a build system (possibly even a build system which can be reasonably language agnostic).
I saw in another discussion post that you are keen to have just one way of building carbon projects. However I think there'd be a lot of merit to template languages being used for building to compiled languages. It's a much nicer dx experience for what most people use pre-processors for imo, allows one to extend/modify/limit syntax as one sees fit, can enforce all sorts of safety, possibly even build to multiple different languages etc.. I wonder if those officially involved with carbon would be interested in discussing/exploring/experimenting with using template language/engines for these sorts of things? Possibly even as an alternative or even replacement for building carbon rather than doing an entirely separate compiler (could certainly be useful for prototyping as well). Didn't seem appropriate to start multiple discussions sorry that this is somewhat unrelated to the discussion topic.
Beta Was this translation helpful? Give feedback.
All reactions