News for hackers. Stuff that matters.
Re:Blink won’t implement pointer events by realusername on Friday August 15, 2014 @12:40PM (#8182951)
One thing which makes me sad is the lack of structure of the Javascript API. Everything is now built using Javascript and the JS VM is not following any UNIX principles in its implementation. I would really like to have a UNIX-like JS API.

A small example: let's say that you want to redirect the error output to the standard output.

Since everything is a file descriptor on UNIX, you can just call dup2(2) and this won't have any repercussion on other parts of the program. You can also redirect any error to a file just by using this on a file descriptor you got from open (2).

But in Javascript, everything is different, you have to redeclare console.error and hope that this won't break anything if some library is doing exactly the same thing as you somewhere. This is also the same problem with XMLHttpRequest and various javascript APIs. (including the File and Blob API to read files on the browser).

Re:Blink won’t implement pointer events by reubenmorais on Friday August 15, 2014 @12:52PM (#8183031)
>Since everything is a file descriptor on UNIX, you can just call dup2(2) and this won't have any repercussion on other parts of the program.

You chose an unfortunate example. From the dup2 documentation:

     The object referenced by the descriptor does not distinguish between fildes and fildes2 in any way.
     Thus if fildes2 and fildes are duplicate references to an open file, read(2), write(2) and lseek(2)
     calls all move a single pointer into the file, and append mode, non-blocking I/O and asynchronous I/O
     options are shared between the references.  If a separate pointer into the file is desired, a different
     object reference to the file must be obtained by issuing an additional open(2) call.  The close-on-exec
     flag on the new file descriptor is unset.
Re:Blink won’t implement pointer events by evmar on Friday August 15, 2014 @12:56PM (#8183046)
And on top of that, you have to worry about CLOEXEC if your process can fork, so you need to consider using dup3.
Re:Blink won’t implement pointer events by Bahamut on Friday August 15, 2014 @12:42PM (#8182965)
What you are talking about aren't JavaScript APIs, but browser APIs.
Re:Blink won’t implement pointer events by tlrobinson on Friday August 15, 2014 @12:52PM (#8183033)
It sounds like you want something like Node.js Streams? People have written Stream adapters for XMLHttpRequest and such.

There's also this: https://github.com/whatwg/streams