- "Process exited with signal 6" -> look up which signal.

I think we are talking past one another.  That is the function of `codeset-symbol`, translating a 6 into the symbol SIGABRT.

True.

But why you'd want to translate SIGABRT into 6 (which is what `codeset-number` does) is a mystery to me.  Presumably Scheme procedures would accept SIGABRT rather than 6.

They don't. It's early days of HLL-LLL wrappers. Abstractions are leaky.

E.g. Gauche:

> (sys-kill (sys-getpid) 'SIGINT)
*** ERROR: ScmSmallInt required, but got SIGINT

but this works:

> (sys-kill (sys-getpid) (codeset-number 'signal 'SIGINT))

Took two minutes to find this example. There are sure to be many more.

As a mixed-level programmer, I also want to get a feel for the territory. With codeset-number, you can do things like this:

(list-sort (lambda (a b) (< (codeset-number 'errno a) (codeset-number 'errno b))) (codeset-symbols 'errno)) => (EPERM ENOENT ESRCH EINTR EIO ENXIO E2BIG ENOEXEC EBADF ECHILD EDEADLK ENOMEM EACCES EFAULT ENOTBLK EBUSY EEXIST EXDEV ENODEV ENOTDIR EISDIR EINVAL ENFILE
 EMFILE ENOTTY ETXTBSY EFBIG ENOSPC ESPIPE EROFS ...)

Here we can see the evolution of the codeset over time, the low errno's are older and more stable. Introspection is an important goal of the SRFI, and I don't think the introspection facilities are as useful if the mapping is not bidirectional.

Reply via email to