>>>>> "B" == Benoit Cerrina <benoit.cerrina / writeme.com> writes:

B> in the ruby source, I don't understand why in the rb_dvar_curr
B> method the iteration over the dynamic variable stops at the first
B>  variable with a null id while the dvar_asgn_internal with curr == true will
B> stop only at the
B> second variable with a null id?


 Well, if you want to know such things, it's best to have a node dumper
 (look in RAA you have some extensions) and look at parse.y (assignable()
 for example). here a little example :

   1.times do |i|         # here you have a NODE_DASGN_CURR
      i = 12              # here you have a NODE_DASGN_CURR
      1.times do
         1.times do
            1.times do
               i = 2      # here you have a NODE_DASGN
            end
         end
      end
   end

 If you try to assign a value to a variable, and this variable can be a
 dynamic variable and don't exist (or exist in the curent level) then ruby
 create a NODE_DASGN_CURR 

 When rb_dvar_curr() is called it look *only* in the first level of dynamic
 variable (each level (#times do in my example) are seperated with a null
 id). If it's not found it create the id at the current level.

 In my example, the first NODE_DASGN_CURR will create the dynamic variable
 and assign a value, the second will only assign it a value

 When you have a NODE_DASGN this mean that a dynamic variable exist in a
 previous level and in this case ruby don't test for the null id when it
 try to retrieve it.


Guy Decoux