Hacker News new | ask | show | jobs
by pdehaan 2152 days ago
At a guess, it makes the language simpler. The main function is just that -- a function. It uses tools the language already has to deal with arguments and exit codes.

Arguably it also keeps things like libraries simpler. For example, what would it mean for me to have top-level expressions in a dynamic shared library? Does it execute as soon as I dlopen() it? Does it create an implicit "init" function that I need to call?

1 comments

Um, DLLs have it.

I used it to inject my own code in foreign executables.

Thanks, that's new to me (or at least I've ignored it long enough to have forgotten if I had learned it before).