Re: How many people are interested in designing the OS interface?
Lassi Kortela 10 May 2019 10:10 UTC
> I'm okay with standardizing a facade here when what underlies it is bad
> (like termio), but in general I'd rather standardize a low-level API so
> that high-level APIs (also definitely in scope) can be mostly portable
> rather than non-portable. This would include things like a high-level
> directory API that caches the full path and file-info (stat) information
> lazily as it goes, a popen-ish API, and so on.
I'd say anything that involves caching things in Scheme is one level
higher than things like popen, which in turn are higher than fork/exec.
In my experience writing portable code, the thing to do is to look for a
reasonable abstraction that covers all existing OSes. (When writing an
application, you also consider the simplest abstraction that covers the
need of that application, but here we don't have that luxury.) If you
wonder about what the right level of abstraction _should_ be in
principle without considering the actual environment, or considering
only your favorite part of it (Unix), the environment will not yield to
your wishes. Like most people, I had to have this lesson delivered to me
several times before it sunk in. Eventually I yielded and my programming
life is much better off for it.
> I realize that this approach won't work for JVM and CLR Schemes, but
> they are free to implement the higher-level stuff over what they have,
> and throw exceptions when low-level operations are done. (That said, I
> note that there is a drop-in version of the Python "os" module for
> Jython at <https://sourceforge.net/projects/jnios/> which uses JNI.)
Why not have the lower-level stuff in a separate SRFI? Then (import
(srfi xyz)) will be a clear signal that the program is using low-level
stuff.
Having very different levels of abstraction / compatibility in the same
SRFI means people will use them ("works on my computer") and then
exceptions will occur on other platforms and/or other Schemes.
To be sure, we should take the opportunity to design and write both/all
these SRFIs in one go. The 60-90 day windows ought to provide enough
room to maneuver comfortably. If writing the documents is a burden, I
will gladly assist with it.