diff libinterp/parse-tree/pt-eval.cc @ 32906:3904d7116c8c bytecode-interpreter

maint: Merge default to byte-codeinterpreter.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Thu, 01 Feb 2024 23:34:35 -0500
parents dc3ff08bfd3f 81d1512a47cb
children e6814a319d4e
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Thu Feb 01 13:29:04 2024 -0500
+++ b/libinterp/parse-tree/pt-eval.cc	Thu Feb 01 23:34:35 2024 -0500
@@ -2288,6 +2288,31 @@
  @result{} 6
 @end group
 @end example
+
+Programming notes:
+@enumerate
+@item
+The @code{end} keyword cannot be used within @code{subsref},
+@code{subsasgn}, or @code{substruct} for manual indexing operations.
+
+@item
+For custom classes, to enable use of @code{end} in indexing expressions it
+must be overloaded with a function definition such as:
+   @example
+   @group
+   function last_index = end (obj, end_dim, ndim_obj)
+     if (end_dim == ndim_obj)
+       last_index = prod (size (obj)(end_dim:ndim_obj));
+     else
+       last_index = size (obj, end_dim);
+     endif
+   endfunction
+   @end group
+   @end example
+For more information see
+@ref{Object Oriented Programming, , Object Oriented Programming}.
+@end enumerate
+
 @seealso{for, parfor, if, do, while, function, switch, try, unwind_protect}
 @end deftypefn */)
 {