bugGNU Octave - Bugs: bug #53375, Interpreter passes magic-colon to...

 
 

bug #53375: Interpreter passes magic-colon to m-file function

Submitter:  Oliver Heimlich <oheim>
Submitted:  Sun 18 Mar 2018 11:51:40 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Oliver Heimlich Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 19 Apr 2018 05:04:26 AM UTC, comment #1: 

Is this with old style @-classes, or modern classdef classes?

Do you have the complete code for a test class that would show this bug?

Rik <rik5>
Group administrator
Sun 18 Mar 2018 11:51:40 AM UTC, original submission:  

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.

Oliver Heimlich <oheim>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by oheim (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code