# Command Line Arguments in Polyglots

It occurs to me that there isn't really a general consensus on how command line arguments should be treated in polyglots. So...

What should the consensus on command line arguments in polyglots be?

I see 2 main options:

• The command line arguments should be the same for all of the programs

• The command line arguments can be different for different programs

I think the first option as better, personally, just because of the ambiguity in byte counts between multiple languages if they have different arguments.

Thoughts? Opinions?

• Do you mean flags or arguments? i.e. lang codefile.txt -aSd vs land codefile.txt input – Rɪᴋᴇʀ Jan 31 '17 at 19:06

I think the default for polyglots should be that each language needs to be run with the simplest possible invocation (i.e. something that would get it a 0 byte penalty for command line arguments). This might or might not lead to the actual command lines being identical (because some interpreters need command line arguments to do anything at all).

The command-line arguments must be allowed to be different, because many language combinations cannot be run with the same command line arguments.

Consider Python and C. Python's invocation is python -c 'code here'. If we required the C version to also have the -c flag, then GCC would output an object file, not an executable (because that's what -c does in GCC).

Potential abuses of command-line flags should be handled as standard loopholes, because a broad policy would certainly cause issues with legitimate uses.

• That doesn't really address the question. If that's the standard invocation it doesn't count towards byte count and it's irrelevant to C. What about nonstandard runtime flags/arguments? – James Jan 31 '17 at 19:37
• @DJMcMayhem It addresses the question as it is written. Nowhere in the question does it state anything about standard vs non-standard flags. – Mego Jan 31 '17 at 19:42

They should be the same for all of the programs, because otherwise this is way too abuse prone.

For example, let's say I wanted to write a vim/python quine (because those are the two languages I know best on this site). Vim allows you run certain commands before opening. So if I give vim the following command line flags, all of the code/keystrokes becomes irrelevant:

vim file.txt -c "norm iHello World!" -c "wq"


This is effectively a zero-byte hello world program. Now my polyglot code is:

print("Hello world!")


This has no side effects in vim because it has already exited. This is very clearly two different answers but if command line flags don't need to be the same, then this is a perfectly valid polyglot answer.

I'm sure there are many language combinations with similar abuses, this is just one example.

You can also imagine a language that just runs command line args as python/golfscript/jelly/whatever and ignores all code.