githwxi / ATS-Postiats

ATS2: Unleashing the Potentials of Types and Templates
www.ats-lang.org
Other
354 stars 54 forks source link

exn type information #264

Closed okeuday closed 2 years ago

okeuday commented 3 years ago

With source code like:

...
try f() with
  | e:exn => ...

The e value doesn't provide:

If the exn type had this data as C string literal data that is accessible, that would be helpful. I was surprised that $showtype didn't provide a C string literal for the ATS type as a developer would see it in the ATS source code. I understand the source code example above may be undesirable generally, normally all exceptions should be explicitly specified. However, sometimes complete knowledge of the related source code isn't possible (e.g., with integration source code that is meant to make random source code behave).

https://github.com/githwxi/ATS-Postiats/blob/7f5bea78c8849e730ca9b89bb513d25674b06ae5/src/CBOOT/ccomp/runtime/ats_prelude.c#L136-L138 shows that ats_exn_type already has a name available, though it appears inaccessible in ATS source code.

githwxi commented 3 years ago

This is true only if you compile ATS to C. In ATS3, this issue will be addressed.