*Exception.Show used to work differently when the traceback contains one frame
vs more frames. Harmonize how they work, and consistent with how parse errors
and compilation errors are shown.
- Change Context to export all its fields.
- Include end position in Context, and include it in Show.
- Remove the Type field from Error, and express it using an ErrorTag type
parameter instead.
- Make {Pack Unpack}CognateErrors type-safe with the new ErrorTag mechanism, and
rename them to just {Pack Unpack}Errors.
The Error methods used to show the start and end indices, while the Show methods
used to show line ranges.
Showing line:col of the start position seems to be pretty standard; both Go and
Rust do that.
I tried including the line:col of the end position too, but can't find a good
enough format.
This change is a preparation step for refining all *Op types to return Exception
as the error.
Keeping Exception as a struct type will make such a change error-prone, since
a (*Exception)(nil) != error(nil), so if an *Op returns a nil *Exception, it
is not nil if the return value is stored in an error-typed variable.
* Use a "type" field to identify the type, instead of predicates in the exc:
module.
* Make the reason values behave more like structmaps, including a Repr that
mimics a map.
This fixes#208.