in reply to One line accessor method style.
It's short, elegant, and gets the job done.Sounds like typical Perl to me.
Will it confuse peopleNo doubt it will confuse people. It's almost impossible to write some code that doesn't confuse people. And there will always be people (and unfortunally, relatively more of them can be found on perlmonks) who try to enforce some arbitrary rules on how people should code because it otherwise confuses them (although they try to claim it confuses everyone else as well). Example where this happens:
is it just bad practice in general to rely on the order of evaluations?Not at all. It's only bad practice to rely on the order of evaluation if the order isn't defined. But the order is defined in your case. From perlop:
And then, skipping a paragraph, it defines -> to be left associative.Operator associativity defines what happens if a sequence of the same operators is used one after another: whether the evaluator will evalu- ate the left operations first or the right. For example, in "8 - 4 - 2", subtraction is left associative so Perl evaluates the expression left to right. "8 - 4" is evaluated first making the expression "4 - 2 == 2" and not "8 - 2 == 6".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: One line accessor method style.
by dragonchild (Archbishop) on Feb 23, 2005 at 18:09 UTC | |
|
Re^2: One line accessor method style.
by Anonymous Monk on Feb 23, 2005 at 22:33 UTC |