3 ms·
>If you don't know, when you run `echo -n foo bar`, the shell splits that according to its syntax and runs `echo` with the arguments, `-n`, `foo`, and `bar`. Th
by seemslegit 7y ago
>If you don't know, when you run `echo -n foo bar`, the shell splits that according to its syntax and runs `echo` with the arguments, `-n`, `foo`, and `bar`. The array of those 4 strings is argv.
So it does, albeit a better example of the shell doing something nontrivial would be replacing file patterns with filenames, but it doesn't help since my program could be expecting a list of urls instead and has no standardized way to tell the shell this.
>To better expand on what fctorial is probably trying to say, argv is a simple list of strings. Plain text is a nice common ground among the myriad of programming languages that executables can be written in. In order replace options with "a structured, typed, reflective API", argv could no longer be a simple list of strings. There would have to be a common typesystem among all programming languages. It wouldn't just be needed for the understanding of argv, but also for the output, since the output of programs is used to feed the arguments of other programs. This puts heavy restrictions on the liberty programming languages can take in defining their own typesystems while retaining compatibility with such an inter-program typesystem.
Yes, a language-agnostic reflective type system with a shell and supporting language tools, it's a pretty big implementation and coordination effort and an even greater one to retroactively describe the command line semantics of existing commands so not holding my breath here.
>Besides that, it would be more inconvenient to use interactively. For example, if you want to differentiate between a number 5 and a string "5", you're going to have to add syntax, like the quotes I used in this sentence. You can see the inconvenience by setting you shell to be something like python, for example. There would be too much syntax for interactive use.
A matter of preference I suppose as I have been using jupyter/ipython for all "shell" tasks for quite a while.