14
\$\begingroup\$

Languages differ greatly in the amount of functionality contained in the main namespace. Most of the PHP main functions, have counterparts in Perl core libraries. What should the policy be on character counts in such cases?

For example, my solution for the NxN spiral used the Perl library Math::Complex. Possible outcomes:

  • Allow command-line calls such as perl -MMath::Complex script.pl to include libraries.
  • Require use Math::Complex; in the code.
  • Do not allow libraries.

Of course, this is just another instance of the problem of trying to compare languages, but there is some value in defining an objective measure.

\$\endgroup\$
4

2 Answers 2

14
\$\begingroup\$

I'd say use

use Math::Complex;

and be done with it. If PHP can solve something shorter than Perl because Perl requires a module, then so be it. I cringe every time I have to write [Math]::floor() or something like that because it's so verbose, but it still is a trait of the language.

And some languages are better for golfing certain problems than others. I guess there is no point in denying that.

\$\endgroup\$
2
  • \$\begingroup\$ Languages do indeed have different advantages, but then the question is: which command-line parameters would be allowed? \$\endgroup\$
    – user475
    Commented Feb 10, 2011 at 14:06
  • 6
    \$\begingroup\$ @Tim: The usual answer is: command-line arguments count towards the character count. \$\endgroup\$ Commented Feb 10, 2011 at 14:20
3
\$\begingroup\$

My opinion is that, unless the question says otherwise, any freely available library existing before the question was asked should be permissible. However, the requisite import statements should be counted towards the byte count. Additionally, a link to the library should be included in the description/explanation part of the answer.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ You should include relevant imports in the count, no matter if it is a complete program or function. \$\endgroup\$
    – Geobits
    Commented Aug 4, 2015 at 14:30

You must log in to answer this question.