octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59737] end keyword not passed to overloaded s


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #59737] end keyword not passed to overloaded subsref function within custom classdef
Date: Fri, 2 Feb 2024 08:53:31 -0500 (EST)

Follow-up Comment #3, bug#59737 (group octave):

Yes, this should be documented. The question is where. 

'help end' produces a keyword description, but it seems end and most other
keywords don't actually appear anywhere I can find in the online
documentation.  (And adding @DOCSTRING{end} add it to the end of
https://docs.octave.org/latest/Index-Expressions.html, which i believe is the
first time it's topically introduced, generates a bunch of errors because the
@seealso's point to other keywords not in the documentation. Apparently that
doesn't work.)  For now I've added the following to the end docstring:

  Programming notes:
       1. The ‘end’ keyword cannot be used within ‘subsref’,
‘subsasgn’,
          or ‘substruct’ for manual indexing operations.

       2. For custom classes, ‘end’ can be overloaded to enable use in
          class indexing expressions with a function definiton such as:

                  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

          For more information see Object Oriented Programming.

pushed to stable as:
https://hg.savannah.gnu.org/hgweb/octave/rev/cf43680cd221

Will look at getting the keyword docstring into Indexing Operations, where the
Programming Notes should cover this issue. 
Inability to use end should probably also be mentioned within the subs___
functions.  Will look at whether it also makes sense to add something
somewhere under Object Oriented Programming.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59737>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]