Turns out GCC has imperative argument handling
hisham.hm
hisham.hm
Every other tool I know has either an output flag (-o) or takes the first argument as input and the second as output.
To make things even worse: linker groups can include source inputs, not just arguments passed to the linker. Both clang and GCC seem to be aware of this and will compile the inputs, treating them as if they aren't inside the linker group[1]. Real build systems rely on this!
But hang on, this is Linux where file extensions are basically just decoration. So if GCC now has special behaviour (and a different linker invocation) depending if the file is a source or an object file, does that mean GCC has to do content sniffing to figure out what the command is supposed to do?
Also it's pretty well known that the order of command line arguments passed to the linker is important. It is sometimes also needed to pass a library to the linker multiple times.
Edit: and the need for listing a dependency twice is to resolve mutually dependent object files. If A depends on symbols from B and B depends on symbols from A, you can link A,B,A or B,A,B (per the aforementioned reasoning).
Depending on how you count, surely dd should take the cake? Otherwise, you're just including the group of commands that uses arguments as a command language, and I don't think that's actually such a small group; ffmpeg does the same thing, too.
I mean, find uses parentheses for forcing evaluation precedence, e.g. -foo -or \( -bar -and -baz \). That's pretty unusual.
$ find -type f .
find: paths must precede expression: `.'
It's like the tool knows exactly what you want to do, but still refuses to do it just because. $ git grep Congrats -i
fatal: option '-i' must come before non-option arguments
Frustrating.They just seem to produce a syntax error no matter where I use them. But if they have no purpose, then why not simply treat them as nonspecial characters?
E.g.
echo hello :-) ;
is invalid syntax, even though it doesn't seem to cause any ambiguities with any other bash syntax features. Why not just allow this and treat it like echo "hello" ":-)";
?I think as a rule of thumb, if you have to mentally keep track of some internal data structure to make sense of your invocation, you're usually pretty deep in "imperative" territory.
> and recursively call “do_things_this_way” on one branch and “do_things_that_way” on the other.
That's the usual algorithm by which imperative logic is translated into equivalent functional logic though.
We know for about as long as computers exit that the two are equivalent in terms of computational power - in the sense that any imperative program can be translated into a functional program that does the same thing and vice versa. That doesn't mean the two programs are identical though.
So that is to say, each option which specifies some setting affecting files to the right of it on the command line is introducing a new version of the previous environment, in which that setting is altered, and the scope of that environment is the remainder of the command line.
I've been aware of picolisp presenting, IIRC, only an imperitive option.