in reply to Optimize string value assignment

Don't forget that ?: is also an lvalue. Next week you can spend many happy afternoons working out what a nest of things like $c eq $d ? $c ? $d : $c : $e : $f = $g ne $h ? $i : $j; means.

The trinary operator is not the problem with understanding code like that. Great heaps of hard-coded ununified opaque logic are. Redesign is the answer.

Update: Heh, got carried away, CombatSquirrel++ spotted too many terms on the left. Repaired, it might read (if that's the word for it), $c eq $d ? $c ? $d : $c : $e = $g ne $h ? $i : $j; It all helps prove the point that micro-optimizing logical operations is less important than making them fit the application and the humans who must understand it.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Optimize string value assignment
by CombatSquirrel (Hermit) on Aug 28, 2003 at 18:27 UTC
    It means problems caused by a syntax error ;-). What about two instead of three colons on the LHS?
    Cheers,
    CombatSquirrel.
    Entropy is the tendency of everything going to hell.