Re: Safe enumerations for codesets Lassi Kortela 14 Dec 2022 12:42 UTC

> You don´t write (define-enumeration <errno> ...) but
> (define-enumaration errno (EPERM ...) errno-set).
>
> Then (errno EPERM) => 'EPERM (with compile-time checking whether EPERM
> is allowed!)

I see. That works out well (with no changes to the SRFI):

(define-enumeration errno
   (EPERM
    ENOENT
    ESRCH
    EINTR
    EIO
    ENXIO
    E2BIG
    ENOEXEC
    EBADF
    ECHILD
    EDEADLK
    ENOMEM
    EACCES
    EFAULT)
   errno-set)

(codeset-message 'errno (errno ENOENT))

The only problem is that the name of the set, 'errno, is still quoted.