Re: Safe enumerations for codesets
Lassi Kortela 14 Dec 2022 09:38 UTC
P.S. It would be neat to do something like:
(codeset-message (errno ENOENT))
Since the procedure's arglist changes, this would take another SRFI
(which could be an alternative to this one, such that both SRFIs can
query the same underlying codesets).
But I can't find anything in R6RS to get the "name" of an enumeration.
Perhaps something like this would work:
(define-enumeration <errno>
(EPERM
ENOENT
ESRCH
EINTR
EIO)
errno)
(codeset-associate-enum 'errno (errno))
(codeset-message (errno ENOENT))