in reply to Re^2: my $a outside sort block incompatibility
in thread my $a outside sort block incompatibility

I have significant difficulty in accepting that hypothesis.

$i/$j/(occasionally) $k are sufficiently widely-used and well-known that they are acceptable as loop counters. $x/$y/$z are appropriate for geometric coordinates, again due to long and widespread use.

Offhand, I can think of no other cases in which a single-character variable name is "reasonably appropriate", regardless of whether it happens to conflict with a magical name built into the language or not.

  • Comment on Re^3: my $a outside sort block incompatibility

Replies are listed 'Best First'.
Re^4: my $a outside sort block incompatibility
by BrowserUk (Patriarch) on Feb 21, 2009 at 14:08 UTC
    Offhand, I can think of no other cases in which a single-character variable name is "reasonably appropriate",

    How about the long standing convention of my( $r, $g, $b );?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^4: my $a outside sort block incompatibility
by Porculus (Hermit) on Feb 22, 2009 at 02:24 UTC

    $u and $v are also standard for coordinates, as of course is $r (in the company of a $theta).

    And plenty of other things use single-letter variables by convention. If I were implementing a quadratic equation solver, for example, I would consider it obfuscation to name the coefficients anything other than $a, $b, and $c.

    The question should never be "does this variable name meet some arbitrary standard", but rather "will my successor, trying to maintain this code in a few years' time, immediately grasp what this variable is for". If the answer is "yes" (and can be justified!), then any name is potentially appropriate, regardless of length.