Safe enumerations for codesets Lassi Kortela (13 Dec 2022 12:09 UTC)
Re: Safe enumerations for codesets Marc Nieper-Wißkirchen (14 Dec 2022 08:17 UTC)
Re: Safe enumerations for codesets Lassi Kortela (14 Dec 2022 09:05 UTC)
Re: Safe enumerations for codesets Lassi Kortela (14 Dec 2022 09:39 UTC)
Re: Safe enumerations for codesets Marc Nieper-Wißkirchen (14 Dec 2022 11:29 UTC)
Re: Safe enumerations for codesets Lassi Kortela (14 Dec 2022 12:42 UTC)
Re: Safe enumerations for codesets Marc Nieper-Wißkirchen (14 Dec 2022 18:26 UTC)
Re: Safe enumerations for codesets Lassi Kortela (15 Dec 2022 09:29 UTC)
Re: Safe enumerations for codesets Lassi Kortela (15 Dec 2022 09:48 UTC)

Re: Safe enumerations for codesets Lassi Kortela 14 Dec 2022 09:05 UTC

> The disadvantage of this approach is that you bind many identifiers in
> your namespace.

Matter of taste. It's unlikely that people need uppercase C identifiers
for some other purpose. In any case, one can also do:

(define errno/ENOENT 'ENOENT)
...

> For a better approach (which should be promoted instead), see
> `define-enumeration' in R6RS and SRFI 209.

It's a bit unwieldy:

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

You'd have to do something like this:
 > (apply codeset-message 'errno (enum-set->list (errno ENOENT)))

Would it be too much if the SRFI mandated (or recommended?) R6RS
implementations to take single-member enum-sets in addition to symbols,
and do an implicit enum-set->list?