changeset 16442:302157614308

deprecate symbol_table::varref functions * ov-usr-fcn.h (octave_user_function::argn_varref, octave_user_function::nargin_varref, octave_user_function::nargout_varref, octave_user_function::varargin_varref): Delete unused variables. * symtab.h (symbol_table::symbol_record::symbol_record_ref::assign, symbol_table::symbol_record::symbol_record_ref::do_non_const_unary_op, symbol_table::symbol_record::do_non_const_unary_op, (symbol_table::symbol_record::is_undefined, symbol_table::symbol_record::assign, symbol_table::assign, symbol_table::force_assign, symbol_table::global_assign, symbol_table::persistent_assign, symbol_table::top_level_assign, symbol_table::do_assign, symbol_table::do_persistent_assign): New functions. (symbol_table::symbol_record::symbol_record_ref::varref): Avoid calls to deprecated functions. (symbol_table::varref, symbol_table::force_varref, symbol_table::global_varref, symbol_table::persistent_varref, symbol_table::top_level_varref, symbol_table::do_varref, symbol_table::do_persistent_varref): Deprecate. (symbol_table::symbol_reference::is_black_hole): New function. * oct-lvalue.h, oct-lvalue.cc: Store symbol_reference instead of pointer to octave_value object. (octave_lvalue::value): Now const. (octave_lvalue::object): Delete. * pt-id.cc (tree_identifier::lvalue): Construct octave_lvalue from sym, not sym->varref. * ls-mat5.cc, oct-lvalue.cc, oct-lvalue.h, pt-jit.cc, error.cc, load-save.cc, symtab.cc, symtab.h, variables.cc, ov-fcn-handle.cc, ov-usr-fcn.cc, ov-usr-fcn.h, oct-parse.in.yy, pt-eval.cc, pt-id.h, pt-idx.cc, mex.cc: Change all uses of varref functions to use assign instead. Use varval instead of varref where appropriate. * load-save.cc (install_loaded_variable): Don't manipulate symbol_record directly.
author John W. Eaton <jwe@octave.org>
date Sat, 06 Apr 2013 11:51:23 -0400
parents ee652dcc9ecc
children 7a2ee6ea7800
files libgui/src/workspace-model.cc libgui/src/workspace-model.h libgui/src/workspace-view.cc libinterp/interp-core/ls-mat5.cc libinterp/interp-core/mex.cc libinterp/interp-core/oct-lvalue.cc libinterp/interp-core/oct-lvalue.h libinterp/interp-core/pt-jit.cc libinterp/interpfcn/error.cc libinterp/interpfcn/load-save.cc libinterp/interpfcn/symtab.cc libinterp/interpfcn/symtab.h libinterp/interpfcn/variables.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-usr-fcn.cc libinterp/octave-value/ov-usr-fcn.h libinterp/octave.cc libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-id.cc libinterp/parse-tree/pt-id.h libinterp/parse-tree/pt-idx.cc
diffstat 22 files changed, 303 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/workspace-model.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libgui/src/workspace-model.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -56,7 +56,6 @@
 void
 workspace_model::request_update_workspace ()
 {
-  octave_link::post_event (this, &workspace_model::update_workspace_callback);
 }
 
 QModelIndex
@@ -168,6 +167,7 @@
   return item->data(idx.column());
 }
 
+#if 0
 void
 workspace_model::update_workspace_callback (void)
 {
@@ -213,3 +213,4 @@
 
   endResetModel();
 }
+#endif
--- a/libgui/src/workspace-model.h	Sat Apr 06 07:53:00 2013 -0400
+++ b/libgui/src/workspace-model.h	Sat Apr 06 11:51:23 2013 -0400
@@ -131,8 +131,6 @@
   void insert_top_level_item (int at, tree_item *treeItem);
   tree_item *top_level_item (int at);
 
-  void update_workspace_callback (void);
-
 public slots:
   void request_update_workspace ();
 
--- a/libgui/src/workspace-view.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libgui/src/workspace-view.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -114,8 +114,6 @@
 void
 workspace_view::model_changed ()
 {
-  _workspace_model->update_workspace_callback ();
-
   // This code is very quirky and requires some explanation.
   // Usually, we should not deal with collapsing or expanding ourselves,
   // because the view itself determines (based on the model) whether it
--- a/libinterp/interp-core/ls-mat5.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interp-core/ls-mat5.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -1013,7 +1013,7 @@
                     std::string key = m2.key (p0);
                     octave_value val = m2.contents (p0)(0);
 
-                    symbol_table::varref (key, local_scope, 0) = val;
+                    symbol_table::assign (key, val, local_scope, 0);
                   }
               }
 
--- a/libinterp/interp-core/mex.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interp-core/mex.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -3250,7 +3250,7 @@
           if (! error_state)
             frame.add_fcn (octave_call_stack::pop);
 
-          symbol_table::varref (name) = mxArray::as_octave_value (ptr);
+          symbol_table::assign (name, mxArray::as_octave_value (ptr));
         }
       else
         mexErrMsgTxt ("mexPutVariable: symbol table does not exist");
--- a/libinterp/interp-core/oct-lvalue.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interp-core/oct-lvalue.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -32,12 +32,12 @@
 void
 octave_lvalue::assign (octave_value::assign_op op, const octave_value& rhs)
 {
-  if (val)
+  if (! is_black_hole ())
     {
       if (idx.empty ())
-        val->assign (op, rhs);
+        sym->assign (op, rhs);
       else
-        val->assign (op, type, idx, rhs);
+        sym->assign (op, type, idx, rhs);
     }
 }
 
@@ -57,33 +57,33 @@
 void
 octave_lvalue::do_unary_op (octave_value::unary_op op)
 {
-  if (val)
+  if (! is_black_hole ())
     {
       if (idx.empty ())
-        val->do_non_const_unary_op (op);
+        sym->do_non_const_unary_op (op);
       else
-        val->do_non_const_unary_op (op, type, idx);
+        sym->do_non_const_unary_op (op, type, idx);
     }
-  else
-    error ("internal: invalid operation on ~");
 }
 
 octave_value
-octave_lvalue::value (void)
+octave_lvalue::value (void) const
 {
   octave_value retval;
 
-  if (val)
+  if (! is_black_hole ())
     {
+      octave_value val = sym->varval ();
+
       if (idx.empty ())
-        retval = *val;
+        retval = val;
       else
         {
-          if (val->is_constant ())
-            retval = val->subsref (type, idx);
+          if (val.is_constant ())
+            retval = val.subsref (type, idx);
           else
             {
-              octave_value_list t = val->subsref (type, idx, 1);
+              octave_value_list t = val.subsref (type, idx, 1);
               if (t.length () > 0)
                 retval = t(0);
             }
--- a/libinterp/interp-core/oct-lvalue.h	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interp-core/oct-lvalue.h	Sat Apr 06 11:51:23 2013 -0400
@@ -30,26 +30,27 @@
 
 #include "oct-obj.h"
 #include "pt-idx.h"
+#include "symtab.h"
 
 class
 octave_lvalue
 {
 public:
 
-  octave_lvalue (octave_value *v = 0)
-    : val (v), type (), idx (), nel (1)
-    { }
+  octave_lvalue (const symbol_table::symbol_reference& s
+                   = symbol_table::symbol_reference ())
+    : sym (s), type (), idx (), nel (1)
+  { }
 
   octave_lvalue (const octave_lvalue& vr)
-    : val (vr.val), type (vr.type), idx (vr.idx), nel (vr.nel)
-    {
-    }
+    : sym (vr.sym), type (vr.type), idx (vr.idx), nel (vr.nel)
+  { }
 
   octave_lvalue& operator = (const octave_lvalue& vr)
     {
       if (this != &vr)
         {
-          val = vr.val;
+          sym = vr.sym;
           type = vr.type;
           idx = vr.idx;
           nel = vr.nel;
@@ -60,19 +61,24 @@
 
   ~octave_lvalue (void) { }
 
-  bool is_black_hole (void) const { return val == 0; }
+  bool is_black_hole (void) const { return sym.is_black_hole (); }
 
-  bool is_defined (void) const { return val && val->is_defined (); }
-
-  bool is_undefined (void) const { return ! val || val->is_undefined (); }
+  bool is_defined (void) const
+  {
+    return ! is_black_hole () && sym->is_defined ();
+  }
 
-  bool is_map (void) const { return val && val->is_map (); }
+  bool is_undefined (void) const
+  {
+    return is_black_hole () || sym->is_undefined ();
+  }
 
-  void define (const octave_value& v)
-    {
-      if (val)
-        *val = v;
-    }
+  bool is_map (void) const
+  {
+    return value().is_map ();
+  }
+
+  void define (const octave_value& v) { sym->assign (v); }
 
   void assign (octave_value::assign_op, const octave_value&);
 
@@ -86,13 +92,11 @@
 
   void do_unary_op (octave_value::unary_op op);
 
-  octave_value value (void);
-
-  const octave_value *object (void) const { return val; }
+  octave_value value (void) const;
 
 private:
 
-  octave_value *val;
+  symbol_table::symbol_reference sym;
 
   std::string type;
 
--- a/libinterp/interp-core/pt-jit.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interp-core/pt-jit.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -2182,7 +2182,7 @@
 
       // do not store for loop bounds temporary
       if (name.size () && name[0] != '#')
-        symbol_table::varref (arguments[i].first) = real_arguments[i];
+        symbol_table::assign (arguments[i].first, real_arguments[i]);
     }
 
   octave_quit ();
--- a/libinterp/interpfcn/error.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interpfcn/error.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -1345,8 +1345,8 @@
                   m.contents ("identifier") = ids;
                   m.contents ("state") = states;
 
-                  symbol_table::varref
-                    (".saved_warning_states.", scope, context) = m;
+                  symbol_table::assign
+                    (".saved_warning_states.", m, scope, context);
 
                   // Now ignore the "local" argument and continue to
                   // handle the current setting.
--- a/libinterp/interpfcn/load-save.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interpfcn/load-save.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -146,13 +146,12 @@
 {
   if (global)
     {
-      symbol_table::symbol_record& sr = symbol_table::insert (name);
-      sr.clear ();
-      sr.mark_global ();
-      sr.varref () = val;
+      symbol_table::clear (name);
+      symbol_table::mark_global (name);
+      symbol_table::global_assign (name, val);
     }
   else
-    symbol_table::varref (name) = val;
+    symbol_table::assign (name, val);
 }
 
 // Return TRUE if NAME matches one of the given globbing PATTERNS.
@@ -1281,7 +1280,7 @@
           return;
         }
 
-      octave_value struct_var = symbol_table::varref (struct_name);
+      octave_value struct_var = symbol_table::varval (struct_name);
 
       if (! struct_var.is_map () || struct_var.numel () != 1)
         {
--- a/libinterp/interpfcn/symtab.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interpfcn/symtab.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -123,7 +123,7 @@
   octave_value retval;
 
   if (is_global ())
-    retval = symbol_table::global_varref (name ());
+    retval = symbol_table::global_varval (name ());
   else
     {
       retval = varval ();
@@ -1325,13 +1325,11 @@
         {
           symbol_record sr = p->second;
 
-          // FIXME -- should we be using something other than varref here?
-
           if (sr.is_global ())
-            return symbol_table::global_varref (name);
+            return symbol_table::global_varval (name);
           else
             {
-              octave_value& val = sr.varref ();
+              octave_value val = sr.varval ();
 
               if (val.is_defined ())
                 return val;
@@ -1667,7 +1665,7 @@
       std::string name = args(0).string_value ();
 
       if (! error_state)
-        symbol_table::varref (name) = args(1);
+        symbol_table::assign (name, args(1));
       else
         error ("set_variable: expecting variable name as first argument");
     }
--- a/libinterp/interpfcn/symtab.h	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interpfcn/symtab.h	Sat Apr 06 11:51:23 2013 -0400
@@ -215,12 +215,63 @@
         value_stack.push_back (v);
       }
 
+      void assign (const octave_value& value,
+                   context_id context = xdefault_context)
+      {
+        varref (context) = value;
+      }
+
+      void assign (octave_value::assign_op op,
+                   const std::string& type,
+                   const std::list<octave_value_list>& idx,
+                   const octave_value& value,
+                   context_id context = xdefault_context)
+      {
+        varref(context).assign (op, type, idx, value);
+      }
+
+      void assign (octave_value::assign_op op, const octave_value& value,
+                   context_id context = xdefault_context)
+      {
+        varref(context).assign (op, value);
+      }
+
+      void do_non_const_unary_op (octave_value::unary_op op,
+                                  context_id context = xdefault_context)
+      {
+        varref(context).do_non_const_unary_op (op);
+      }
+
+      void do_non_const_unary_op (octave_value::unary_op op,
+                                  const std::string& type,
+                                  const std::list<octave_value_list>& idx,
+                                  context_id context = xdefault_context)
+      {
+        varref(context).do_non_const_unary_op (op, type, idx);
+      }
+
       octave_value& varref (context_id context = xdefault_context)
       {
+        // We duplicate global_varref and persistent_varref here to
+        // avoid calling deprecated functions.
+
         if (is_global ())
-          return symbol_table::global_varref (name);
+          {
+            symbol_table::global_table_iterator p
+              = symbol_table::global_table.find (name);
+
+            return (p == symbol_table::global_table.end ())
+              ? symbol_table::global_table[name] : p->second;
+          }
         else if (is_persistent ())
-          return symbol_table::persistent_varref (name);
+          {
+            static octave_value foobar;
+
+            symbol_table *inst
+              = symbol_table::get_instance (symbol_table::current_scope ());
+
+            return inst ? inst->do_persistent_varref (name) : foobar;
+          }
         else
           {
             if (context == xdefault_context)
@@ -299,13 +350,12 @@
 
             if (is_persistent ())
               {
-                symbol_table::persistent_varref (name)
-                  = varval ();
+                symbol_table::persistent_assign (name, varval ());
 
                 unmark_persistent ();
               }
 
-            varref () = octave_value ();
+            assign (octave_value ());
           }
       }
 
@@ -375,7 +425,7 @@
           {
             mark_persistent ();
 
-            varref () = symbol_table::persistent_varval (name);
+            assign (symbol_table::persistent_varval (name));
           }
         // FIXME -- this causes trouble with recursive calls.
         // else
@@ -479,6 +529,40 @@
     octave_value
     find (const octave_value_list& args = octave_value_list ()) const;
 
+    void assign (const octave_value& value,
+                 context_id context = xdefault_context)
+    {
+      rep->assign (value, context);
+    }
+
+    void assign (octave_value::assign_op op,
+                 const std::string& type,
+                 const std::list<octave_value_list>& idx,
+                 const octave_value& value,
+                 context_id context = xdefault_context)
+    {
+      rep->assign (op, type, idx, value, context);
+    }
+
+    void assign (octave_value::assign_op op, const octave_value& value,
+                 context_id context = xdefault_context)
+    {
+      rep->assign (op, value, context);
+    }
+
+    void do_non_const_unary_op (octave_value::unary_op op)
+    {
+      rep->do_non_const_unary_op (op);
+    }
+
+    void do_non_const_unary_op (octave_value::unary_op op,
+                                const std::string& type,
+                                const std::list<octave_value_list>& idx)
+    {
+      rep->do_non_const_unary_op (op, type, idx);
+    }
+
+    // Delete when deprecated varref functions are removed.
     octave_value& varref (context_id context = xdefault_context)
     {
       return rep->varref (context);
@@ -502,6 +586,11 @@
       return rep->is_defined (context);
     }
 
+    bool is_undefined (context_id context = xdefault_context) const
+    {
+      return ! rep->is_defined (context);
+    }
+
     bool is_valid (void) const
     {
       return rep->is_valid ();
@@ -572,20 +661,30 @@
   symbol_reference
   {
   public:
-    symbol_reference (void) : scope (-1) {}
-
-    symbol_reference (symbol_record record,
-                       scope_id curr_scope = symbol_table::current_scope ())
+
+    symbol_reference (void) : scope (-1) { }
+
+    symbol_reference (const symbol_record& record,
+                      scope_id curr_scope = symbol_table::current_scope ())
       : scope (curr_scope), sym (record)
-    {}
+    { }
+
+    symbol_reference (const symbol_reference& ref)
+      : scope (ref.scope), sym (ref.sym)
+    { }
 
     symbol_reference& operator = (const symbol_reference& ref)
     {
-      scope = ref.scope;
-      sym = ref.sym;
+      if (this != &ref)
+        {
+          scope = ref.scope;
+          sym = ref.sym;
+        }
       return *this;
     }
 
+    bool is_black_hole (void) const { return scope < 0; }
+
     // The name is the same regardless of scope.
     const std::string& name (void) const { return sym.name (); }
 
@@ -612,9 +711,11 @@
       }
     };
   private:
+
     void update (void) const
     {
       scope_id curr_scope = symbol_table::current_scope ();
+
       if (scope != curr_scope || ! sym.is_valid ())
         {
           scope = curr_scope;
@@ -1181,10 +1282,25 @@
     return inst ? inst->do_insert (name) : foobar;
   }
 
-  static octave_value& varref (const std::string& name,
-                               scope_id scope = xcurrent_scope,
-                               context_id context = xdefault_context,
-                               bool force_add = false)
+  static void assign (const std::string& name,
+                      const octave_value& value = octave_value (),
+                      scope_id scope = xcurrent_scope,
+                      context_id context = xdefault_context,
+                      bool force_add = false)
+  {
+    static octave_value foobar;
+
+    symbol_table *inst = get_instance (scope);
+
+    if (inst)
+      inst->do_assign (name, value, context, force_add);
+  }
+
+  // Use assign (name, value, scope, context, force_add) instead.
+  static octave_value&
+  varref (const std::string& name, scope_id scope = xcurrent_scope,
+          context_id context = xdefault_context, bool force_add = false)
+          GCC_ATTR_DEPRECATED
   {
     static octave_value foobar;
 
@@ -1193,13 +1309,27 @@
     return inst ? inst->do_varref (name, context, force_add) : foobar;
   }
 
-  // Convenience function to greatly simplify
+  // Convenience function to simplify
   // octave_user_function::bind_automatic_vars
-  static octave_value& force_varref (const std::string& name,
-                                     scope_id scope = xcurrent_scope,
-                                     context_id context = xdefault_context)
+
+  static void force_assign (const std::string& name,
+                            const octave_value& value = octave_value (),
+                            scope_id scope = xcurrent_scope,
+                            context_id context = xdefault_context)
   {
-    return varref (name, scope, context, true);
+    assign (name, value, scope, context, true);
+  }
+
+  // Use force_assign (name, value, scope, context) instead.
+  static octave_value&
+  force_varref (const std::string& name, scope_id scope = xcurrent_scope,
+                context_id context = xdefault_context) GCC_ATTR_DEPRECATED
+  {
+    static octave_value foobar;
+
+    symbol_table *inst = get_instance (scope);
+
+    return inst ? inst->do_varref (name, context, true) : foobar;
   }
 
   static octave_value varval (const std::string& name,
@@ -1211,8 +1341,23 @@
     return inst ? inst->do_varval (name, context) : octave_value ();
   }
 
+  static void
+  global_assign (const std::string& name,
+                 const octave_value& value = octave_value ())
+
+  {
+    global_table_iterator p = global_table.find (name);
+
+    if (p == global_table.end ())
+      global_table[name] = value;
+    else
+      p->second = value;
+  }
+
+  // Use global_assign (name, value) instead.
   static octave_value&
-  global_varref (const std::string& name)
+  global_varref (const std::string& name) GCC_ATTR_DEPRECATED
+
   {
     global_table_iterator p = global_table.find (name);
 
@@ -1227,10 +1372,22 @@
     return (p != global_table.end ()) ? p->second : octave_value ();
   }
 
+  static void
+  top_level_assign (const std::string& name,
+                    const octave_value& value = octave_value ())
+  {
+    assign (name, value, top_scope (), 0);
+  }
+
+  // Use top_level_assign (name, value) instead.
   static octave_value&
-  top_level_varref (const std::string& name)
+  top_level_varref (const std::string& name) GCC_ATTR_DEPRECATED
   {
-    return varref (name, top_scope (), 0);
+    static octave_value foobar;
+
+    symbol_table *inst = get_instance (top_scope ());
+
+    return inst ? inst->do_varref (name, 0, true) : foobar;
   }
 
   static octave_value
@@ -1239,7 +1396,19 @@
     return varval (name, top_scope (), 0);
   }
 
+  static void
+  persistent_assign (const std::string& name,
+                     const octave_value& value = octave_value ())
+  {
+    symbol_table *inst = get_instance (xcurrent_scope);
+
+    if (inst)
+      inst->do_persistent_assign (name, value);
+  }
+
+  // Use persistent_assign (name, value) instead.
   static octave_value& persistent_varref (const std::string& name)
+  GCC_ATTR_DEPRECATED
   {
     static octave_value foobar;
 
@@ -2241,7 +2410,7 @@
 
                 if (val.is_defined ())
                   {
-                    sr.varref (0) = val;
+                    sr.assign (val, 0);
 
                     sr.mark_inherited ();
                   }
@@ -2284,7 +2453,25 @@
       return p->second;
   }
 
-  octave_value& do_varref (const std::string& name, context_id context, bool force_add)
+  void do_assign (const std::string& name, const octave_value& value,
+                  context_id context, bool force_add)
+  {
+    table_iterator p = table.find (name);
+
+    if (p == table.end ())
+      {
+        symbol_record& sr = do_insert (name, force_add);
+
+        sr.assign (value, context);
+      }
+    else
+      p->second.assign (value, context);
+  }
+
+  // Use do_assign (name, value, context, force_add) instead.
+  // Delete when deprecated varref functions are removed.
+  octave_value& do_varref (const std::string& name, context_id context,
+                           bool force_add)
   {
     table_iterator p = table.find (name);
 
@@ -2305,6 +2492,19 @@
     return (p != table.end ()) ? p->second.varval (context) : octave_value ();
   }
 
+  void do_persistent_assign (const std::string& name,
+                             const octave_value& value)
+  {
+    persistent_table_iterator p = persistent_table.find (name);
+
+    if (p == persistent_table.end ())
+      persistent_table[name] = value;
+    else
+      p->second = value;
+  }
+
+  // Use do_persistent_assign (name, value) instead.
+  // Delete when deprecated varref functions are removed.
   octave_value& do_persistent_varref (const std::string& name)
   {
     persistent_table_iterator p = persistent_table.find (name);
@@ -2372,7 +2572,7 @@
     for (table_iterator p = table.begin (); p != table.end (); p++)
       {
         symbol_record& sr = p->second;
-        octave_value& val = sr.varref ();
+        octave_value val = sr.varval ();
         if (val.is_object ())
           p->second.clear (my_scope);
       }
--- a/libinterp/interpfcn/variables.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/interpfcn/variables.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -616,7 +616,7 @@
 void
 set_global_value (const std::string& nm, const octave_value& val)
 {
-  symbol_table::global_varref (nm) = val;
+  symbol_table::global_assign (nm, val);
 }
 
 octave_value
@@ -633,7 +633,7 @@
 void
 set_top_level_value (const std::string& nm, const octave_value& val)
 {
-  symbol_table::top_level_varref (nm) = val;
+  symbol_table::top_level_assign (nm, val);
 }
 
 // Variable values.
@@ -1881,7 +1881,7 @@
         }
       else
         {
-          symbol_table::force_varref (ans) = val;
+          symbol_table::force_assign (ans, val);
 
           if (print)
             val.print_with_name (octave_stdout, ans);
--- a/libinterp/octave-value/ov-fcn-handle.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -466,7 +466,7 @@
                       break;
                     }
 
-                  symbol_table::varref (name, local_scope, 0) = t2;
+                  symbol_table::assign (name, t2, local_scope, 0);
                 }
             }
         }
@@ -651,7 +651,7 @@
                   break;
                 }
 
-              symbol_table::varref (name, local_scope) = t2;
+              symbol_table::assign (name, t2, local_scope);
             }
         }
 
@@ -1159,7 +1159,7 @@
                       break;
                     }
 
-                  symbol_table::varref (dsub.name, local_scope) = dsub.tc;
+                  symbol_table::assign (dsub.name, dsub.tc, local_scope);
                 }
             }
         }
--- a/libinterp/octave-value/ov-usr-fcn.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -601,8 +601,8 @@
       // which might be redefined in a function.  Keep the old argn name
       // for backward compatibility of functions that use it directly.
 
-      symbol_table::force_varref ("argn") = arg_names;
-      symbol_table::force_varref (".argn.") = Cell (arg_names);
+      symbol_table::force_assign ("argn", arg_names);
+      symbol_table::force_assign (".argn.", Cell (arg_names));
 
       symbol_table::mark_hidden (".argn.");
 
@@ -610,8 +610,8 @@
       symbol_table::mark_automatic (".argn.");
     }
 
-  symbol_table::force_varref (".nargin.") = nargin;
-  symbol_table::force_varref (".nargout.") = nargout;
+  symbol_table::force_assign (".nargin.", nargin);
+  symbol_table::force_assign (".nargout.", nargout);
 
   symbol_table::mark_hidden (".nargin.");
   symbol_table::mark_hidden (".nargout.");
@@ -619,16 +619,16 @@
   symbol_table::mark_automatic (".nargin.");
   symbol_table::mark_automatic (".nargout.");
 
-  symbol_table::varref (".saved_warning_states.") = octave_value ();
+  symbol_table::assign (".saved_warning_states.");
 
   symbol_table::mark_automatic (".saved_warning_states.");
   symbol_table::mark_automatic (".saved_warning_states.");
 
   if (takes_varargs ())
-    symbol_table::varref ("varargin") = va_args.cell_value ();
+    symbol_table::assign ("varargin", va_args.cell_value ());
 
   // Force .ignored. variable to be undefined by default.
-  symbol_table::varref (".ignored.") = octave_value ();
+  symbol_table::assign (".ignored.");
 
   if (lvalue_list)
     {
@@ -650,7 +650,7 @@
               k += p->numel ();
             }
 
-          symbol_table::varref (".ignored.") = bh;
+          symbol_table::assign (".ignored.", bh);
         }
     }
 
--- a/libinterp/octave-value/ov-usr-fcn.h	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.h	Sat Apr 06 11:51:23 2013 -0400
@@ -454,20 +454,6 @@
   jit_function_info *jit_info;
 #endif
 
-#if 0
-  // The symbol record for argn in the local symbol table.
-  octave_value& argn_varref;
-
-  // The symbol record for nargin in the local symbol table.
-  octave_value& nargin_varref;
-
-  // The symbol record for nargout in the local symbol table.
-  octave_value& nargout_varref;
-
-  // The symbol record for varargin in the local symbol table.
-  octave_value& varargin_varref;
-#endif
-
   void print_code_function_header (void);
 
   void print_code_function_trailer (void);
--- a/libinterp/octave.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/octave.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -243,7 +243,7 @@
 {
   assert (symbol_table::at_top_level ());
 
-  symbol_table::varref (".nargin.") = argc - 1;
+  symbol_table::assign (".nargin.", argc - 1);
 
   symbol_table::mark_hidden (".nargin.");
 
--- a/libinterp/parse-tree/oct-parse.in.yy	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/parse-tree/oct-parse.in.yy	Sat Apr 06 11:51:23 2013 -0400
@@ -4224,7 +4224,7 @@
               if (! error_state)
                 {
                   if (valid_identifier (nm))
-                    symbol_table::varref (nm) = args(2);
+                    symbol_table::assign (nm, args(2));
                   else
                     error ("assignin: invalid variable name in argument VARNAME");
                 }
--- a/libinterp/parse-tree/pt-eval.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -538,7 +538,7 @@
       // Make sure that any variable with the same name as the new
       // function is cleared.
 
-      symbol_table::varref (nm) = octave_value ();
+      symbol_table::assign (nm);
     }
 }
 
--- a/libinterp/parse-tree/pt-id.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/parse-tree/pt-id.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -126,7 +126,7 @@
   if (sym->is_added_static ())
     static_workspace_error ();
 
-  return octave_lvalue (&(sym->varref ()));
+  return octave_lvalue (sym);
 }
 
 tree_identifier *
--- a/libinterp/parse-tree/pt-id.h	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/parse-tree/pt-id.h	Sat Apr 06 11:51:23 2013 -0400
@@ -160,7 +160,7 @@
 
   octave_lvalue lvalue (void)
     {
-      return octave_lvalue (0); // black hole lvalue
+      return octave_lvalue (); // black hole lvalue
     }
 };
 
--- a/libinterp/parse-tree/pt-idx.cc	Sat Apr 06 07:53:00 2013 -0400
+++ b/libinterp/parse-tree/pt-idx.cc	Sat Apr 06 11:51:23 2013 -0400
@@ -443,12 +443,7 @@
 
   if (! error_state)
     {
-      const octave_value *tro = retval.object ();
-
-      octave_value tmp;
-
-      if (tro)
-        tmp = *tro;
+      octave_value tmp = retval.value ();
 
       octave_idx_type tmpi = 0;
       std::list<octave_value_list> tmpidx;