Open jclark opened 3 years ago
Here's a first cut at categorization.
@manuranga My current thinking is to have a distinct type Panic in lang.error, and then distinct subtypes XyzPanic for each specific panic. It's more convenient to use error:Panic
than runtime:Panic
because the error prefix is predeclared.
My current thinking is to have a distinct type Panic in lang.error
Sounds good.
Should we also recommend users (eg: stdlib) to subtype from error:Panic
to indicate that it's intended to be panic
ed with (instead of being returned).
If so, panicking with a non-error:Panic
subtype should be be which of the following:
Ok / Not recommend / Compile time warning / Compile time error
@manuranga I made a separate issue #839 for this.
The language spec (including the langlib documentation) should specify panics in more detail. At the moment, it just says there's a panic without going into any detail about the error value associated with the panic.
Langlib (probably mostly in lang.error) should define categorize possible panics using distinct error types. When the spec says there's a panic, it should further give the error type (as defined in langlib) of the error value associated with the panic. In some cases, it could also specify a detail record.