5 ms·
Stopped reading after reading main() returning doesn't end the (interactive) program and you have to manually hookup a signal, otherwise the program will contin
by hermitdev 7y ago
Stopped reading after reading main() returning doesn't end the (interactive) program and you have to manually hookup a signal, otherwise the program will continue running indefinitely. Seems error prone and very counterintuitive to me.
- coldtea 7y agoI've stopped reading the above comment after "Stopped reading after". I've never read anything insightful and not knee-jerky coming after those words...
- HocusLocus 7y agoI've stopped reading altogether. Is there a Youtube tutorial?
- mruts 7y agoI've stopped reading after "I've stopped reading the above"..
- nudq 7y agoDo you read your own comments? (Asking for a logician friend...)
- coldtea 7y agoYes, as a meta-comment they belong to a different class (see Russel and co).
- systems 7y agowhere did you read that
- hermitdev 7y agoTowards the end of [0] which was linked from "I want my greeting in a window from [1]. The link has since been stricken out from when I looked at it several hours ago, so maybe its outdated? I don't know... I've only done GUI work on Windows, but I've never had to register a signal handler to get my app to exit. Yeah, you might register handlers for events to control how the app shuts down (e.g. to save unsaved docs), but mandatory? I've not seen that before. [0] https://pike.lysator.liu.se/docs/tut/hello/window.md https://pike.lysator.liu.se/docs/tut/hello/window.md [1] https://pike.lysator.liu.se/docs/tut/ https://pike.lysator.liu.se/docs/tut/
- fernly 7y agoThat's very typical of programs using a GUI platform. One way or another you have to kick off an event handler, whether it's TKinter or Qt or in this case, GTK. The event handler runs independent of your code and has to be told when to quit. I have to agree that GTK.Alert("Hello world!") -> signal_connect("destroy", lambda(){ exit(0); }); does seem to be less than intuitive and not a pretty thing to drop into a hello-world tutorial!
- hermitdev 7y agoYes, registering events in a GUI is common, but for a "Hello world!" to shutdown? Never seen it needed for something that simple.
- mpcjanssen 7y agoThe cli hello world exits with the main return value.
- em-bee 7y agoand it's also false. you missed that you have to explicitly tell pike to continue by returning -1 from main or calling the backend event loop explicitly. any other program ends when main is exiting.
- codezero 7y agoYou’re missing out on a lot if you decide to stop reading things for reasons you find counterintuitive.