[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: Dmitry Gutov
Subject: Re: master 1e3b0f2: Improve doc strings of project.el
Date: Sat, 18 Jul 2020 14:58:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 18.07.2020 13:10, Eli Zaretskii wrote:
Date: Sat, 18 Jul 2020 11:05:46 +0200
From: tomas@tuxteam.de
Cc: emacs-devel@gnu.org

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 :-)

IMO, there's nothing opaque about a file descriptor.  It is just a
number.  The abstraction here isn't in the descriptor itself, it's in
what it _represents_.

Potato, pot-ah-to.

The descriptor is actually a _handle_ for an
object that itself is not exposed at all; you can only manipulate it
via the handle.

So it's actually even more opaque.

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.

That detail is not a general trait of a handle.  Another popular
example of a handle is a FILE pointer in C, where the details of the
object it points to are generally not public.  Here, the numerical
value of the handle is no longer small.

A FILE pointer is less interesting, given that the structure on the other end is usually more or less the same. Even if it's concealed.

Yet another similar abstraction, much more close to our domain, is the
Lisp_Object representation on the C level: with a couple of
exceptions, each object is actually a handle of a C struct;


"There's nothing opaque about a project instance. It is just a Lisp_Object."

P.S. The interpretation of a file descriptor as an index into some
small table doesn't hold in modern OSes anyway.  It was true for
MS-DOS, but modern OSes have moved away of that.

Meaning that it's an abstraction that stood the test of time.

reply via email to

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