News for hackers. Stuff that matters.
Re:The Pike Programming Language by hermitdev on Friday July 05, 2019 @08:39PM (#20366987)
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.
Re:The Pike Programming Language by coldtea on Friday July 05, 2019 @08:51PM (#20367024)
I've stopped reading the above comment after "Stopped reading after".

I've never read anything insightful and not knee-jerky coming after those words...

Re:The Pike Programming Language by nudq on Sunday July 07, 2019 @06:34AM (#20374463)
Do you read your own comments? (Asking for a logician friend...)
Re:The Pike Programming Language by coldtea on Sunday July 07, 2019 @11:51AM (#20375670)
Yes, as a meta-comment they belong to a different class (see Russel and co).
Re:The Pike Programming Language by fernly on Friday July 05, 2019 @10:22PM (#20367344)
That'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!
Re:The Pike Programming Language by hermitdev on Friday July 05, 2019 @10:38PM (#20367410)
Yes, registering events in a GUI is common, but for a "Hello world!" to shutdown? Never seen it needed for something that simple.
Re:The Pike Programming Language by mpcjanssen on Saturday July 06, 2019 @01:42AM (#20368141)
The cli hello world exits with the main return value.
Re:The Pike Programming Language by codezero on Sunday July 07, 2019 @11:29PM (#20379670)
You’re missing out on a lot if you decide to stop reading things for reasons you find counterintuitive.
Re:The Pike Programming Language by em-bee on Sunday July 07, 2019 @12:43PM (#20375990)
and 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.

Re:The Pike Programming Language by systems on Friday July 05, 2019 @09:49PM (#20367225)
where did you read that
Re:The Pike Programming Language by hermitdev on Friday July 05, 2019 @10:34PM (#20367394)
Towards 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 [1] https://pike.lysator.liu.se/docs/tut/