8
\$\begingroup\$

I made a language (and its not based on Brain-flak for once!). My language, Klein requires that you specify a topological surface in which the program is embedded. Currently this means passing 3 bytes to the command line to denote one of 12 supported surfaces.

Currently we score command line arguments as the difference from the default. However none of the 12 surfaces is really a "default", and no surface is certainly not the default because it errors immediately. How should I score answers in Klein? Should all of the surfaces be considered their own languages? should I just add 3 to every answer written in Klein?

\$\endgroup\$
8
  • \$\begingroup\$ I would think of the surface specification as being code, and always count it, since as you say there is no default. \$\endgroup\$
    – isaacg
    May 17, 2017 at 6:27
  • 2
    \$\begingroup\$ That sounds like bad language design to me. If I dig out a program I wrote six months ago, how will I remember the correct topology? Fix the design by putting all the code in the source file and this question becomes moot. \$\endgroup\$ May 17, 2017 at 6:53
  • \$\begingroup\$ @PeterTaylor's point is very good, but if you want to save those three bytes every time, just have eight interpreters. Or, you could use one byte and start every program with one of eight characters, but that cuts into the 256 characters you have to work with \$\endgroup\$
    – Stephen
    May 19, 2017 at 21:10
  • \$\begingroup\$ Why do you use 3 bytes for only 8 surfaces? \$\endgroup\$
    – nmjcman101
    Aug 18, 2017 at 14:18
  • \$\begingroup\$ @nmjcman101 There are 12 surfaces. \$\endgroup\$
    – Wheat Wizard Mod
    Aug 18, 2017 at 14:20
  • \$\begingroup\$ @WheatWizard Which is still way less than could be encoded in a single byte, right? (There's another 8 in the first paragraph) \$\endgroup\$
    – nmjcman101
    Aug 18, 2017 at 14:22
  • \$\begingroup\$ @nmjcman101 I'm not looking to minimize byte count. If I reduce it to a single byte then people have to memorize 12 different flags. I would prefer it to be readable rather than terse. \$\endgroup\$
    – Wheat Wizard Mod
    Aug 18, 2017 at 14:30
  • \$\begingroup\$ @WheatWizard I just checked out what all the bytes actually mean and that makes sense, it was just counter intuitive on PPCG at first glance, thanks! \$\endgroup\$
    – nmjcman101
    Aug 18, 2017 at 15:13

1 Answer 1

10
\$\begingroup\$

They're evidently part of the program, and they're important information so they should be counted. That said, I'd probably count them as 3 bytes (not 5 as would normally the case when you have to add a space, a hyphen and your three characters to the command-line invocation) since the "standard invocation" always includes those three bytes, it's just not clear what those three bytes are. That's no different from treating the first three bytes of the actual source file as a mandatory header.

So, to propose a general rule: if an implementation requires some command-line argument but no particular value is the default, count the length of the argument without adding bytes for the preceding space and hyphen that are normally needed to add another argument. Optional arguments that can't be combined with existing ones should still add those two bytes if they require additional spaces and hyphens.

\$\endgroup\$
3
  • \$\begingroup\$ Careful. If you say "without adding bytes for spaces or hyphens" someone will try a loophole where the number of hyphens is the information encoding. It's really the common prefix which you're proposing should be free. \$\endgroup\$ May 17, 2017 at 6:48
  • \$\begingroup\$ @PeterTaylor good catch, thank you \$\endgroup\$ May 17, 2017 at 6:49
  • 3
    \$\begingroup\$ How does this reconcile with Perl's "free" versioning flags? \$\endgroup\$ Aug 18, 2017 at 13:15

Not the answer you're looking for? Browse other questions tagged .