>> I can certainly wrap Gauche's low-level syscall API with guard and >> translate <system-error> to srfi-170 error, in every srfi-170 API. The >> overhead isn't small and I'd rather avoid it if I can. > > Loko Scheme's implementation of SRFI 198 uses the R6RS condition system. > This way there is no need to use guard, because any syscall error > anywhere in Loko already raises an R6RS condition and SRFI 198 just > needs to recognize it. Maybe you can use a similar strategy in Gauche, > can you teach SRFI 198 to understand <system-error>? > > In Loko, the foreign-error:* procedures understand R6RS conditions and > check their argument to see which kind of condition they've been given. > make-foreign-error translates its argument into conditions. This also > has the benefit of letting any R6RS code handle the &who, &message and > &irritants part of the SRFI 198 error. > > It works because SRFI 198 defines a constructor and accessors that hide > the concrete type of conditions. I haven't been keeping up with the > discussion lately, but I hope that this aspect hasn't changed. Great! This is exactly the kind of implementation I was hoping the abstract data type would enable. I recommend the same for Gauche as well. I also did a Common Lisp port using the same principle. If needed, an ADT can also have multiple implementations, e.g. one based on a native condition type and another based on a record type. The `foreign-status?` predicate and `foreign-status-ref` accessor will just have to be written to recognize both. Gauche has generic functions that can handle this if needed.