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

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

[Octave-bug-tracker] [bug #53375] Interpreter passes magic-colon to m-fi


From: Oliver Heimlich
Subject: [Octave-bug-tracker] [bug #53375] Interpreter passes magic-colon to m-file function
Date: Sun, 18 Mar 2018 07:51:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <http://savannah.gnu.org/bugs/?53375>

                 Summary: Interpreter passes magic-colon to m-file function
                 Project: GNU Octave
            Submitted by: oheim
            Submitted on: Sun 18 Mar 2018 12:51:40 PM CET
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Oliver Heimlich
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

When a class overrides the “numel” method and an object of the class is
indexed with '()' and '.' at the same time, the overridden “numel” method
can be called with the magic-colon as an argument.


myclass ()(:).xxx


This magic-colon is of limited use in the m-file. Trying to use it on
functions, e. g. the built-in numel function, always results in an error
“invalid use of colon in function argument list”.


function result = numel (this, varargin)
  result = numel (this.internaldata, varargin{:});
endfunction


However, I have found out that the magic-colon can be used in an indexing
expression with '()', so the following would be a work-around for
above-mentioned method:


function result = numel (this, varargin)
  result = numel (this.internaldata(varargin{:}));
endfunction


I'd suggest that the magic-colon is replaced by the string ':' before it is
passed to the m-file “numel” method.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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