Vanilla PHP has better argument parsing than many recent hipster language. Go has some sort of ugly non conventional argument library which is barely usable, Node has none. But nothing beats vanilla Python for that tasks IMHO.
import "flag"
var ip = flag.Int("flagname", 1234, "help message for flagname")
...
// flag.Parse() once in the main function
vs import argparse
parser = argparse.ArgumentParser()
parser.add_argument("square", help="display a square of a given number",
type=int)
...
args = parser.parse_args()
In the Go example you get a pointer just like in C, in the python example you get a special object and can access its fields. Both are simple, but Golang is IMHO closer to C in this matter.flag package bothers me because it breaks getopt conventions for no good reason.
> . . . argument parsing . . .
> Node has none.
https://nodejs.org/docs/latest/api/process.html#process_proc...This is not argument parsing. I'm pretty sure Node doesn't even do anything, it just gets an array of strings from the CLI, argv C style isn't getting options prefixed with - or -- directly from the CLI, and putting them in a map or something. So no, node has no facility in its standard library for that. Node is not known for its extensive standard library in anyway.
I know Perl, C, C++ and PHP quite well, but I'd never, ever call C-like syntax a plus.
It's astonishing how feeble modern PHP is, that to comapre strings you often have to use strcmp. In 2017. It's like all the cruft of ANSI C with a whole bunch of $ characters spiked in.
It's the most common syntax pattern of popular languages. Statistically, more developers know a language with a "C-like" syntax than Lisp, Haskell, Erlang..
Well, versus whatever abomination bash uses, it's quite readable…
C-style syntax is fairly popular [1]. If it had lisp syntax or haskell syntax most people would complain that they can't figure out what's going on without learning all that syntax.
>that to comapre strings you often have to use strcmp
For equality === works just fine. For < and > there is no one obviously correct order, so it's entirely reasonable to use functions for that.
1: https://en.wikipedia.org/wiki/List_of_C-family_programming_l...