nim-works / phy

compiler and vm experiments
MIT License
3 stars 2 forks source link

implement a reporting system #38

Closed zerbina closed 2 months ago

zerbina commented 2 months ago

Summary

Details

The error messages are currently formatted in-place, but the idea is to eventually send dedicated message objects (which store all necessary information for rendering the message to text) to the ReportContext.

zerbina commented 2 months ago

@saem: Here are the observations about error reporting / handling in NimSkull that shaped the current design. Feel free to voice your disagreement with any of them.

I've also tried to take into account the previous discussion that took place regarding error handling and reporting.


The system I came up with is this:

This abstracts away the actual handling and reporting of a message, leaving the logic wanting to report something with a simple interface, while allowing one to swap the implementation at run-time.

For example, errorMax handling, promoting hints and warnings to errors, and stopping on errors would all be the responsibility of the ReportContext implementation.

The used nomenclature is a bit fuzzy, I think, and it probably needs some adjustment.


Error correction is (or at least should) be the sole responsibility of an analysis pass, and it's thus not relevant to the ReportContext system.

saem commented 2 months ago

I believe this is good to merge, doing so now.