News for hackers. Stuff that matters.
Re:Perlwm – a window manager written entirely in Perl by nrdvana on Friday February 14, 2020 @01:11PM (#22328684)
You forgot my favorite one! Xlib is written so badly that there is no graceful way to deal with a connection error to the server - the library gives you one callback to clean up and then it forcibly aborts the process. I looked into why, and its basically because they have no provision for cleanup of failed function calls. If a function can’t return the expected result it would either leave behind a broken internal state of the library or segfault, so they call abort() as a workaround.

If not for this glaring design disaster, it would be possible for a program to attempt re-connecting to a new display server after the previous one crashed. No X11 program has ever done this only because Xlib made it impossible.

Re:Perlwm – a window manager written entirely in Perl by joosters on Friday February 14, 2020 @01:37PM (#22328961)
Would it be possible to solve this by creating a proxy between the xlib application and the X server? This proxy could re-issue failed requests, or reroute them to a different server. Basically, it would be the error-handling layer, so that all xlib calls always seem to work, from the application's viewpoint.

As a proxy, it could improve error handling across all X applications without any application code changes.

Re:Perlwm – a window manager written entirely in Perl by DonHopkins on Friday February 14, 2020 @02:58PM (#22329793)
It would be better for life on Earth as we know it if the proxy simply cut you off from the X server, forcing you to find a better window system to use. It's much better to prevent errors from happening in the first place, than to handle them after they happen.