3 ms·
Globals are idiomatic in all scripting languages except python. You don’t define a function called main, then manually invoke it at the bottom of your bash, pe
by hedora 6y ago
Globals are idiomatic in all scripting languages except python.
You don’t define a function called main, then manually invoke it at the bottom of your bash, perl, etc... script. In python, you do, partially because there is a severe performance penalty for not doing that.
- saila 6y agoAh, I see. I read "which is idiomatic for scripts" as applying to Python scripts and not scripts generally.
- RHSeeger 6y agoDefining a main function and then calling it from the bottom of your script is a mainstay of many people who program in scripting languages. It's certainly how I did things in Tcl. Really, it depends on the type of thing you're writing in the language, moreso than the language itself.