|
SRFIs 170 and 198 (was Licensing of SRFI 170, 198, and 199) hga@xxxxxx (13 Jul 2020 14:43 UTC)
|
|
Re: SRFIs 170 and 198 (was Licensing of SRFI 170, 198, and 199)
John Cowan
(13 Jul 2020 18:33 UTC)
|
|
Re: SRFIs 170 and 198 (was Licensing of SRFI 170, 198, and 199)
hga@xxxxxx
(13 Jul 2020 19:02 UTC)
|
|
Re: SRFIs 170 and 198 (was Licensing of SRFI 170, 198, and 199)
John Cowan
(14 Jul 2020 16:56 UTC)
|
|
SRFI 198 Foreign Errors "error-set" convention repository
hga@xxxxxx
(24 Jul 2020 00:02 UTC)
|
From: Lassi Kortela <xxxxxx@lassi.io> Date: Friday, July 10, 2020 5:45 PM >> At this point with the fate of SRFI 199 in the air, and in any case >> my [Harold's] baby, the steps needed are adding you [John] and me >> to the HTML documents [copyrights] for SRFI 170 and 198. You should >> do the former, you and Lassi need to agree who'll be doing what >> with the expanding 198; I added Lassi to the recipients. I have a >> Chibi Scheme implementation for the current 198, but it might as >> well wait for a pull until the new 198 firms up. > > Thanks. I can write the next draft of 198 unless Harold wants to do > the honors. Don't care about the honor, but everything from SRFI 170 to my own current personal project has been hanging fire on SRFI 198 for a full two weeks. Since I have a lot of time available, I'll go ahead and make a new draft based on your proposal, with the modifications we previously discussed. For naming, I believe nothing works better than Foreign Interface Error Handling for the SRFI, thus for the slot accessor naming, and while I'm at it I'll list them again with explanations: (foreign-error:error-set ferr) → symbol This partitions sets of errors like POSIX errnos vs. a particular database's, or some random library that's being wrapped, etc. (which come to think of it could also return POSIX errors, like if a file can't be found), and the following items will by convention ideally be populated in the same way for a given error set. (foreign-error:code ferr) → alist As previously mentioned, this class of data can't be reduced to a specific set of slots. For example, POSIX has errno number + errno define name, but the databases I'm most familiar with have just a numeric or alphanumeric code. The libsodium cryptography library has neither, the closest is the name of the function that failed, which would properly be put in foreign-error:foreign-interface: (foreign-error:message ferr [locale]) → string (foreign-error:scheme-procedure ferr) → symbol (foreign-error:foreign-interface ferr) → symbol The above is where the SRFI naming choice affects the API, and is made general, could be 'chown for POSIX, could be 'prepare-statement for lots of database interfaces including the PostgreSQL over the wire one, could be 'ecb-cipher-file for my backup program shelling out to a small C program that uses libsodium. (foreign-error:data ferr) → alist I'll include notes that it's fine to use this SRFI in Scheme land for checking (like types) before you burden the foreign interface with a malformed query, and encouraging people to include 'arguments as one of the items in the alist. > I'll also join back in to help finish 170 ASAP. Sorry about the > intermittent and delayed comments on it. Not sure what's left to do that's *required*, other than: * serious progress if not finalization of this error SRFI 198 * Incorporating the resulting changes due to it in the draft * Ditto mechanically changing my Chibi Scheme sample implementation to use it for both POSIX errors and sanity checking before calling POSIX functions * Updating or changing the copyrights to both 170 and 198 I've got some minor touch ups to the Chibi Scheme sample implementation, and inserting a big caveat about it not properly handling errno setting and getting, which will keep it a sample vs. production implementation. There's two things missing from it, one involves getting more into the guts of Chibi Scheme's port system to add the optional buffer-mode argument to fdes->[textual|binary]-[input|output]-port, I'm not sure that's really important since it's so system specific. That is, it doesn't necessarily illuminate anything about interfacing to POSIX, the major purpose of the sample implementation. But there's one bit of pure Scheme which is currently "left as an exercise to the reader", call-with-temporary-filename. There would be real value in finishing that useful helper procedure, since it can be copied wholesale by other R7RS implementations. - Harold