bugGNU Octave - Bugs: bug #32344, syntax difference between 3.2.3...

 
 

bug #32344: syntax difference between 3.2.3 and 3.5+ -- should be documented

Submitter:  Pascal Dupuis <cdemills>
Submitted:  Thu 03 Feb 2011 10:02:43 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Pascal Dupuis Open/Closed:  * Closed
Release:  * 3.2.3 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 08 Feb 2011 08:26:41 AM UTC, comment #2: 

I checked in the following changeset to eliminate the confusing parse error followed by warning followed by error:

http://hg.savannah.gnu.org/hgweb/octave/rev/5252f12537f8

I also added a NEWS entry for this change.

John W. Eaton <jwe>
Group administrator
Mon 07 Feb 2011 08:27:17 AM UTC, comment #1: 

I'd be happy to have a patch that improved the documentation.

John W. Eaton <jwe>
Group administrator
Thu 03 Feb 2011 10:02:43 PM UTC, original submission:  

Consider the following code snippet, with 3 functions defined in the same file:

function x = changes(y)

if 0 == nargin, y = []; endif

a = int16(18);
x = innerfunc(a+y);

%# endfunction : OK with 3.2.3 -- NOK with 3.5.0+

function z = innerfunc(u)

z = u+otherfunc(u);

endfunction

function u = otherfunc(v)
u = log2(double(v));

endfunction


-under 3.2.3, 'changes(0)' produces 22 as result;
-under 3.5+, the same call results in the error:
parse error near line 21 of file changes.m
  inconsistent function endings -- if one function is explicitly ended, so must all the others
warning: nested functions are coerced into subfunctions in file changes.m
error: parse error while reading function file changes.m

The comment at line 8 must be removed in order for the code to run under 3.5+, delivering 22 as result too. This stricter requirement about functions ending should be documented in the upcoming 3.4 release.

Pascal Dupuis <cdemills>
Group Member

 

(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 jwe (Posted a comment)
  • -email is unavailable- added by cdemills (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.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-02-08 jwe StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code