Hacker News new | ask | show | jobs
by ogoffart 871 days ago
FLTK and other libraries cannot be used from JavaScript.

JavaScript is one of the most popular programming language. But a JavaScript dev who needs to make a desktop GUI will usually need to use Electron to bring up a browser for the GUI. This means actually two JavaScript engine (Node and Chromium)

The reason it has to do with Deno is that you need a JavaScript/TypeScript runtime. But you may not need a browser. So you can develop your application in JavaScript using a framework that doesn't use the DOM but show a native window instead.

This is more lightweight and more secure (no risks of HTML injection and the browser is a big attack vector)

3 comments

FLTK is permanently stuck in the 90s. It doesn't have full unicode support, right-to-left & bidirectional text, and doesn't support accessibility tools.

Not to mention that development has been stagnant for 15 years since it's flagship application (Nuke), was ported to QT.

Actually FLTK has full unicode support, right-to-left and bidi text. The limiting factor is the OS. For rtl and bidi, it depends on the OS. On linux for example, if FLTK is built with pango support, it'll support them just fine. On windows and macos, these work out of the box. As for accessibility, the only thing missing is screen reader support. Otherwise tab navigation, ime and other modalities are supported. FLTK's bindings in Rust provide an accesskit adapter which supports screen readers using the accesskit crate.
Alternatively, they could maybe, just maybe, learn another programming language, but that is asking too much in today's culture it seems.
Nothing screams efficient use of time like learning programming languages for every little thing.
It isn't harder than learning new JavaScript frameworks every month.
Haha, JS framework meme.
> FLTK and other libraries cannot be used from JavaScript.

What's the obstacle to using it via FFI (which Deno seems to support)?

Someone has to first write bindings to the library using said FFI. This is not something most JavaScript dev can do. This has to be written by someone who knows C++ and JavaScript, and be good at both to understand all the details. (How the two interacts, how the lifetime of C++ objects play with the garbage collector, how do the inventloop mixes, ...) Writing such binding is a huge work as they the whole API need to be wrapped. And sometimes concept from the one language don't map easily in the other. (eg. templates)

And then you still have to ship an extra binary in addition to Deno itself.

Right, but that's still a far cry from being entirely unable to use them together. And as for the extra binary, that's hardly an obstacle if you already have to ship Deno itself anyway (and that ain't even considering the possibility of statically-linking it into a custom Deno binary).