6 ms·
> API is designed to be a polling loop IMO this is a mistake. The most popular platform in the world does not allow using a polling loop. You can hack things t
by socalgal2 1y ago
> API is designed to be a polling loop
IMO this is a mistake. The most popular platform in the world does not allow using a polling loop. You can hack things to simulate it but eventually you'll run into where this will break for you. Better to start with something more forward compatible.
- IcyWindows 1y agoWhich one are you referring to?
- deleted 1y ago[deleted]
- deleted 1y ago[deleted]
- gt0 1y agoI'm assuming they mean the web.
- IcyWindows 1y agoOh! Of course
- CyberDildonics 1y agoThe most popular platform in the world does not allow using a polling loop I don't know what that means, but just because something else doesn't use a polling loop doesn't mean it's a mistake or the wrong fit. Something like this so simple there is likely to be a lot that gets done inside the main loop, not the least of which is drawing into the buffer which is most of the point.
- adastra22 1y agoI assume you mean the web? I’m not sure why that’d be relevant to a C library.
- socalgal2 1y agoThe Web runs C via WebAssembly, but if you're porting a polling loop app you're going to have a bad time. Conversely, if you start with an event driven app then you lose nothing but gain portability.
- hyperhello 1y agoOkay -- this code is pathologically minimal. If you modify it to use events on the web, will your work extend to all the other platforms?
- socalgal2 1y agoYes, because it's trivial to make an event based loop from a polling loop but not visa-versa. The difference is that an event based loop needs to give up control to the OS. A polling loop does not. So if you have a polling OS you just write few lines to emit your own loop event.
- Zardoz84 1y agowhy hell would you use a c library to make a gui on the web when you have HTML ?
- dardeaup 1y agoMaybe it was a personal goal?
- animuchan 1y agoThis can be a forward compatibility concern: imagine we run a company, and our product is a GUI app written in C or C++. If we also believe that the desktop GUI apps are a thing of the past, and in the future everyone wants only web apps, we'd want to pick a C library for the UI which allows building for the web, for the future scenario where we have to port the app to stay relevant. The scenario might not materialize, but having a contingency plan sure feels nice.
- animuchan 1y agoDoes it really not support this though? I imagine this could be made to work in a WebWorker for example, where you can run the busy loop, and actively let it ingest new messages each iteration.
- vrighter 1y agoGood thing this isn't a library designed for the web then! What's your point here? SDL (this project seems to be a subset of it, in terms of functionality) also uses a polling loop, and it's one of the most popular libraries of this sort around.