in reply to Re: Improve readability of Perl code. Naming reference variables.
in thread Improve readability of Perl code. Naming reference variables.
Yeah, I agree that the suggested reference syntax also could introduce
new issues. For example consider function calls:
Here it is of course possible that the programmer introduces a typo. First, assume he wrote @ when $var is a scalar (i.e. $var is not a reference). This typo will of course confuse a human reader. But the compiler would probably be quite happy. It would just ignore the optional postfix syntax (OPRDS). Hence, there will be no runtime issues with this typo either. Then consider a different typo. The user types @* when he rather meant to type @:func( $var->@ )
Now, this is a more serious mistake. The compiler will assume that the array reference should be dereferenced. Hence, the function will receive $var->[0] instead of the reference $var, likely to cause some sort of runtime malfunction that may be difficult to debug.func( $var->@* )
|
---|
In Section
Meditations