On Wed, Oct 15, 2008 at 8:15 PM, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 15, 2008 at 01:39:32PM -0700, [EMAIL PROTECTED] wrote:
>> -    if $<name> {
>> +    my $name := $<name>;
>> +    if $name {
>> [...]
>> -                    PAST::Val.new( :value(~$<name>[0]) )
>> +                    PAST::Val.new( :value(~$name[0]) )
>> [...]
>> -                PAST::Val.new( :value("$!" ~ ~$<name>[0]) ),
>> +                PAST::Val.new( :value("$!" ~ ~$name[0]) ),
>> [...]
>> -                PAST::Val.new( :value(~$<name>[0]) ),
>> -                make_accessor($/, undef, "$!" ~ ~$<name>[0], 1, 'attribute')
>> +                PAST::Val.new( :value(~$name[0]) ),
>> +                make_accessor($/, undef, "$!" ~ ~$name[0], 1, 'attribute')
>> ...
>
> Instead of setting
>
>    my $name := $<name>;
>
> would this still work if we set it to
>
>    my $name := ~$<name>[0];
>
> and then avoid the subscript and stringification in each use of
> $name later?
>
yep, works fine, in r31992. nice catch. my first pass only covered
about 70% of the file, i'm going to attack the remainder now. then
i'll look for more substantial candidates for refactoring.
~jerry

Reply via email to