7
\$\begingroup\$

I know that compiler flags (such as -D for C/C++) are counted towards byte count, but what about interpreter flags? How would those affect byte count?

Given that the question is specifically about ECMAScript 6, this is more specifically asking if I would have to add 9 to my score for --harmony added to the command node --harmony to use ECMAScript 6?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Just run it in Firefox's console. :P \$\endgroup\$ Commented Jul 18, 2014 at 7:25
  • \$\begingroup\$ @m.buettner It was also intended to address using Node+ES6, which would be a whole lot more suitable for golfing than with Node+ES5 for a variety of reasons (least of which include fewer uses of function and prototype). \$\endgroup\$
    – Claudia
    Commented Jul 18, 2014 at 23:12
  • \$\begingroup\$ Note that you might be able to abbreviate --harmony to --h or --ha \$\endgroup\$
    – user16402
    Commented Jul 27, 2014 at 7:27
  • \$\begingroup\$ @professorfish No, but it doesn't count, anyways, because it's selecting a language version, not defining something. \$\endgroup\$
    – Claudia
    Commented Jul 27, 2014 at 7:36

2 Answers 2

13
\$\begingroup\$

I would say no. ECMAScript 6 is sufficiently different from its previous versions that I would consider it a new language.

(By the same logic, you could technically say that using C++11 would require a +10 character count because of the -std=c++11 compilation flag, and then you could include all sorts of goodies like the object file names and whatnot, which would increase each C++ submission's length by around 50.)

\$\endgroup\$
0
\$\begingroup\$

I would not count flags that choose versions of a language. So, gcc -std=c99 and perl -M5.010 add zero to the score. Likewise, python2.7 (as my computer calls it) adds zero to the score. I also would not count flags like -f in awk -f program.awk, as -f only specifies which file to run.

I do count other flags. I wrote a sed program in 300 characters. I posted it as 299 characters, but changed the count to 299+1 because I used sed -r. After golfing this flag, sed -rf program.sed is 1 more character than sed -f progrma.sed.

Some flags might decrease the character count (or byte count) of a program. I like to avoid flags: I would not type cc -DW=while, I would put #define W while (15 characters) in my program. I would not type perl -n, I would put the shebang #!perl -n (9 characters) on the first line. By doing this, I increase my score and fail at golf.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ +1 for the first paragraph, -1 for the last. Why wouldn't you use -Dw=while and count it towards the character count if that makes your code shorter? Also, shebangs are generally not counted in code-golf. You would only count -n towards the character count. \$\endgroup\$
    – user344
    Commented Jul 22, 2014 at 9:31

You must log in to answer this question.

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