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 15 Dec 2022 09:29 UTC

> I would say that an implementation should export an enumeration type
> such that, e.g. (codeset errno) expands to 'errno, and such that
> (codeset lassi) will be a syntax error (meaning that the lassi codeset
> is not supported).

That doesn't really make sense, as you could do something like:

(codeset-message (codeset some-codeset) (some-other-codeset foo))

and it doesn't ensure that 'foo is in fact part of some-codeset.

It should be something like this instead:

(codeset-message (errno EPIPE))

or:

(errno-message EPIPE) [syntax]

The present SRFI is meant to be a bare minimum foundation that doesn't
express an opinion on enums. It's possible to build enum-based stuff on
top. I think that should generally be done on the user's end, not by the
codeset provider. The codeset provider may not be up to date on all the
latest codes.

I'll add the following to the SRFI's "Examples" section since it works
out of the box without imposing any changes on the SRFI, or on codeset
providers.

(define-enumeration errno
    (EPERM ...)
    errno-set)

(codeset-message 'errno (errno EPERM))