lua-users home
lua-l archive

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


On Mon, Feb 3, 2020 at 10:39 AM Sean Conner wrote:
> > The fact is that a file descriptor does multiple different things (it
> > both controls the stream and provides the stream) so no name will be
> > satisfactory.
>
>   I don't follow.  A file descriptor on POSIX is a integer value that has
> ...

I meant that it is the same "Thing" to be passed to read, write,
ioctl, fcntl, etc. So it serves a lot of purposes. If in your API you
want to use a descriptive name (instead of _tofd), it will be a very
generic and "Opaque" name.

>   I might have failed to fully describe the output from getting the events
> list.  It doesn't return a set of *all* the event sources leaving the user
> to scan through the list looking for ones with activity, it returns a list
> *of only the sources that have activity during that call*.  If I set up
> event monitoring for 10 sources and call set:events(), I might get back a
> list of two events, but both those events have been triggered.

A loop over the returned events is still needed. And it becomes
trickier if the event sources must be handled in a specific order. I
do understand that this is a very minor argumentation. But what do you
think are the drawbacks of using the fd/source as key?

> > Sorry for the very raw state of my ideas.
>
>   So raw they seem like pure speculation and uncertainly about how this
> stuff works.

I explicitely stated that I was putting down some idea, not making a
practical proposal. I just described what I would like to see in a
portable standard library: a notification system that can be extended
to support different kind of events/sources.

I hoped that this kind of talks were welcome. Sorry again if I was wrong.

> > - Object oriented programming
>
>   Why?

I think that a Standard Library /API should provide oop in order to be
taken seriously. I know that constructors, inheritance, private data
and so on can be implemented in 30 lines of lua. But the people just
expect that a Standard Library /API has that 30 lines wired inside.