develooper Front page | perl.perl6.internals | Postings from July 2002

Re: [perl #15800] [PATCH] lexical scope ops, test and example

Thread Previous | Thread Next
From:
Melvin Smith
Date:
July 30, 2002 09:49
Subject:
Re: [perl #15800] [PATCH] lexical scope ops, test and example
Message ID:
OF72B187FD.56716D35-ON85256C06.005C6317@boulder.ibm.com
See my 2 comments:

>  new P0, .PerlInt
>  new P1, .PerlInt
>  new P2, .PerlInt
>  new P3, .PerlInt
>  set P0, 10
>  set P1, 11
>  set P2, 12
>
>  # outer most lexical scope
>  open_lex
   ^^^^^^^^ New pad
>  store_lex P0, "a"
>  find_lex P3, "a"
>  print P3 # prints 10
>  print "\n"
>
>    # nested lexical scope
>    open_lex
>    store_lex P1, "b"
>    find_lex P3, "b"
>    print P3 # prints 11
>    print "\n"
>
>    store_lex P2, "a" # overwrites previous "a"
     ^^^^^^^^^^^^^^^^^ Should not "overwrite", should shadow since it is
stored
                       in the current pad
>    find_lex P3, "a"
>    print P3 # prints 12
>    print "\n"
>
>    close_lex # end of nested lexical scope
     ^^^^^^^^^ Pad goes away, with "b" and "a", so the outer values
               should be back in effect.
>
>  find_lex P3, "a"
>  print P3 # prints 12
>  print "\n"
>  end

I'll apply this, since it is clean, but the semantics need adjustment.
Thanks,

-Melvin Smith

IBM :: Atlanta Innovation Center
melvins@us.ibm.com :: 770-835-6984



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About