[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 1e3b0f2: Improve doc strings of project.el

From: tomas
Subject: Re: master 1e3b0f2: Improve doc strings of project.el
Date: Sat, 18 Jul 2020 11:05:46 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Jul 18, 2020 at 03:55:33AM +0300, Dmitry Gutov wrote:
> On 17.07.2020 18:27, tomas@tuxteam.de wrote:
> >I was rather trying to highlight the contrast between (a) the library
> >designer(s) set the interface design and (b) the interface evolves
> >as a collective effort of designers and users.
> An interface's ability to evolve over time isn't entirely predicated
> on there being no limitations on its use. It can easily change as a
> result of user feedback anyway.

Definitely. But it's not an abrupt transition.

> >Reality will be a mix
> >of both, of course. The term API conveys a hierarchy -- clearly in
> >camp (a).
> >
> >The "system programmer" thing comes from former times, yes.
> BTW, lower level programming is not devoid of abstractions as well.

Absolutely. We are in violent agreement. It's "turtles all the
way down [1]".

> I could be wrong in some details here, but a file descriptor seems
> like a prime example of an abstraction.

Well, that's at the Mother of Abstraction, aka the user space/kernel
space barrier :-)

This one is especially interesting because here you have different
applications which dont quite trust each other. You will see that
(sometimes ugly) pattern repeat whenever you have a similar situation
(web browser, I'm looking at you).

> The docs say it's represented by a number, but it's not a "real"
> number (you never do any arithmetic with it), and an fd can be
> backed by very different mediums: a file on disk, a network socket,
> a pipe, etc. And everything is a number in C anyway. It's an
> "opaque" value.

Yes, this is some kind of OO. But it leaks a couple of things:
first, it's a "small number" (i.e. not some random 64 bit
address, but the pattern of counting up from zero and of building
bitmaps of FDs is considered --mostly-- viable), i.e. the mental
model around is that the kernel "has" a table somewhere indexed
by FD. This detail wasn't probably intended to leak in the first
place, but was just "the obvious thing to do" in a world in which
machines with a 32 bit address space were considered serious iron.

So it somehow creatively leaked. Cf. the select() system call
for a (mis?)use of this leak in a very creative way which gave
us fun for at least 15 to 20 years. These days it's on its way
out. Times change.

> When using it in a piece of code, you don't always have to know what
> kind of file it is. Or you just know it's a socket, for instance.
> But you know there are certain things one can do with a file
> descriptor, like passing it to 'write' or 'read'.

Yes, definitely. Barring errors in the interface design (read()
returning zero bytes is "we're done" in the case of a file and
"currently nothing there, but do come back and retry later" for
a socket :-)

My point in all of that is that (some) leak in the abstractions
might lubricate change.

Writing in the docs "here be dragons, we might well change that
implementation from under you [2]" is fair, and IMO better than
"warranty void if opened" ;-)


[1] https://xkcd.com/1416/
[2] ...but by all means, if you enjoy dragons, go ahead :)

-- tomás

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]