--- src/__max_nargin_optim__.cc.orig
+++ src/__max_nargin_optim__.cc
@@ -70,8 +70,12 @@
   }
   else {
 
+    // Contrary to ->length (), ->size () should work both with older
+    // octave versions which derive 'tree_parameter_list' from
+    // 'base_list' and with newer octave versions which derive
+    // 'tree_parameter_list' from 'std::list'.
     retval = octave_value
-      (fcn.user_function_value ()->parameter_list ()->length ());
+      (fcn.user_function_value ()->parameter_list ()->size ());
   }
 
   return retval;
