def set!(areg)
    
      @to=@o=areg
      @inspect=nil
      class<<self
        def method_missing msg, *args, &block
          @to.send msg, *args, &block
        end
        eval [ :itemrange,:subitemrange,].map {|name|
           "
            def #{name}(*a,&b)
              name='$RegVarItemRangeRecursing#{object_id}'
              if Thread.current[name]
                warning 'hacking itemrange of Reg::var'
                #this is an approximation
                #if I can get an equation solver, this won't hack won't be needed
                (0..Infinity)
              else
                Thread.current[name]=true
                result=@o.#{name}(*a,&b)
                Thread.current[name]=nil
                result
              end
            end
          "
        }.join+
        [ :subregs,:to_h].map {|name|
          "
            def #{name}(*a,&b)
              @o.#{name}(*a,&b)
            end
          "
        }.join
        
        alias_method :cmatch, :cmatch_jit_compiler if instance_methods.include? "cmatch"
        alias_method :bmatch, :bmatch_jit_compiler if instance_methods.include? "bmatch"
      end
      self
    end
def set!(areg)
    
      @to=@o=areg
      @inspect=nil
      class<<self
        def method_missing msg, *args, &block
          @to.send msg, *args, &block
        end
        eval [ :itemrange,:subitemrange,].map {|name|
           "
            def #{name}(*a,&b)
              name='$RegVarItemRangeRecursing#{object_id}'
              if Thread.current[name]
                warning 'hacking itemrange of Reg::var'
                #this is an approximation
                #if I can get an equation solver, this won't hack won't be needed
                (0..Infinity)
              else
                Thread.current[name]=true
                result=@o.#{name}(*a,&b)
                Thread.current[name]=nil
                result
              end
            end
          "
        }.join+
        [ :subregs,:to_h].map {|name|
          "
            def #{name}(*a,&b)
              @o.#{name}(*a,&b)
            end
          "
        }.join
        
        alias_method :cmatch, :cmatch_jit_compiler if instance_methods.include? "cmatch"
        alias_method :bmatch, :bmatch_jit_compiler if instance_methods.include? "bmatch"
      end
      self
    end
include BlankSlate
restore :hash
fer gawds sake, why BlankSlate??!!!
we should only be Multiple and Undoable if @to is as well.
unfortunately, we don't know what @to is when we construct the Variable,
(and its value may change subsequently), so we'll make the conservative
assumption that @to is Multiple and Undoable and so we must be also.