Final review of johnwcowan/srfi-170/srfi-170.html, part 1 through 3.3 File system temp-file-prefix hga@xxxxxx 13 Aug 2020 15:59 UTC
Re: Final review of johnwcowan/srfi-170/srfi-170.html, part 1 through 3.3 File system temp-file-prefix John Cowan 13 Aug 2020 18:18 UTC
On POSIX errnos using 'number as a key, and SRFI 198 not defining that, 'code, etc. as standards at its level hga@xxxxxx 13 Aug 2020 18:46 UTC
Re: On POSIX errnos using 'number as a key, and SRFI 198 not defining that, 'code, etc. as standards at its level John Cowan 13 Aug 2020 20:31 UTC
Re: On POSIX errnos using 'number as a key, and SRFI 198 not defining that, 'code, etc. as standards at its level hga@xxxxxx 13 Aug 2020 21:04 UTC
Clearing up confusion Lassi Kortela 14 Aug 2020 15:12 UTC
Re: Clearing up confusion, and Windows errors as POSIX errno's Lassi Kortela 14 Aug 2020 15:27 UTC
Re: Clearing up confusion, and Windows errors as POSIX errno's hga@xxxxxx 15 Aug 2020 16:50 UTC
Re: Clearing up confusion John Cowan 15 Aug 2020 00:54 UTC
Re: Clearing up confusion Marc Nieper-Wi├čkirchen 15 Aug 2020 10:46 UTC
Clearing up the previous clearing up Lassi Kortela 15 Aug 2020 11:46 UTC
Re: Clearing up the previous clearing up John Cowan 15 Aug 2020 15:03 UTC
Re: Final review of johnwcowan/srfi-170/srfi-170.html, part 1 through 3.3 File system temp-file-prefix hga@xxxxxx 14 Aug 2020 11:31 UTC
Re: Final review of johnwcowan/srfi-170/srfi-170.html, part 1 through 3.3 File system temp-file-prefix John Cowan 14 Aug 2020 13:22 UTC
Re: Final review of johnwcowan/srfi-170/srfi-170.html, part 1 through 3.3 File system temp-file-prefix hga@xxxxxx 14 Aug 2020 14:01 UTC

Re: Clearing up confusion, and Windows errors as POSIX errno's Lassi Kortela 14 Aug 2020 15:27 UTC

Hmm, how about this:

(make-foreign-error
  'set 'windows
  'number 2
  'name 'ERROR_FILE_NOT_FOUND
  'message "File not found"
  'errno-name 'ENOENT)  ; <---------

The 'errno-name property could be a generic one for mapping the native
errors from various systems into equivalent errnos, on a close-enough
basis. For example, any kind of "file not found" error could be mapped
to 'ENOENT.

Using ('set 'errno 'name ENOENT 'number 2) is a bit deceptive when we
know the error is from the Windows API and know the GetLastError() code.
We should return the native Windows code instead. But if we add an extra
'errno-name that should give the best of both worlds.

Perhaps 'errno-equivalent, 'errno-equiv or a simple 'errno as Harold
suggested would be a better name for the property. Users who care about
portable code would be writing code like this:

(define (read-symlink-if-exists path)
   (guard (err ((and (foreign-status? err)
                     (eq? 'ENOENT (foreign-status-ref err 'errno)))
                #f))
     (read-symlink path)))

That doesn't look bad to me, especially given that Windows could be
supported with the same code while preserving native WinAPI error
information.