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

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

[Octave-bug-tracker] [bug #50359] clearer documentation for difference b


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #50359] clearer documentation for difference between isnull and isempty
Date: Thu, 14 Sep 2017 18:23:15 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

Follow-up Comment #24, bug #50359 (project octave):

@Mike: Thank you for the example.  So containers.Map gets refactored regarding
this?  Currently isnull is not used there, so I was not able to find this
example for making it plausible myself.

The documentation is good, only the example can be misleading without knowing
this bug report.


     Return true if X is a special null matrix, string, or single quoted
     string.

     Indexed assignment with such a value on the right-hand side should
     delete array elements.  This function should be used when
     overloading indexed assignment for user-defined classes instead of
     `isempty', to distinguish the cases:

    `A(I) = []'
          This should delete elements if `I' is nonempty.

    `X = []; A(I) = X'
          This should give an error if `I' is nonempty.

     See also: isempty, isindex.


I suggest as example:


    [... as before ...]

    `A(I) = []'

    and

    `X = []; A(I) = X'.

    Assuming in both cases, that `I' is nonempty, the first 
    assignment should delete the respective elements,
    whereas the latter one assigns them an empty matrix, e.g.
    `X' is equivalent to `zeros (0, 0)' in this case and
    will probably result in an error.

     See also: isempty, isindex.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50359>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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