an1sotropy
I'm guessing this person hasn't used (ImageMagick) "convert"; AFAIK it is the program that does the most to turn a sequence of command-line arguments into an imperative scripting "language"
woodruffw
These kinds of complexities make accurately modeling (and instrumenting) build systems incredibly annoying.

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!

[1]: https://github.com/SRI-CSL/gllvm/issues/48

kccqzy
Blame the linker, not GCC.

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.

yjftsjthsd-h
> I thought find was a strong contender for Unix command with the weirdest argument handling, but I guess gcc takes the cake.

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.

rayiner
Pedant: That’s not imperative. You can have a purely functional program that uses a flag in a list to treat subsequent arguments in a list differently. Just have a conditional on the flag, and recursively call “do_things_this_way” on one branch and “do_things_that_way” on the other.
dizzant
Wow I needed precisely -Wl,-whole-archive about a month ago to solve a missing symbol issue in a plug-in. I didn’t find the solution then, and moved on to a different strategy. This is why is scroll hacker news! The random tidbits are essential when you need them.
kazinator
Unless a "goto" feature is implemented, you can't tell whether the command line options work by scoping or by mutation. Without evidence for mutation, you have to give it the benefit of the doubt and call it scoping, which isn't imperative.

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.

jevinskie
Without these linker arguments you have to dive into custom linker scripts since there is no good way to extend/modify the built in ones.
a9h74j
Glad to hear this is a well-known thing. ESR did a review of cli modes maybe two years ago and IIRC he mentioned only two, not mentioning imperitive.

I've been aware of picolisp presenting, IIRC, only an imperitive option.

emmelaich
It was always like this for C. Otherwise, how does your game know to draw() the cowboy or have the cowboy draw() his weapon?
sr.ht