bugGNU Octave - Bugs: bug #32083, nested functions and developers...

 
 

bug #32083: nested functions and developers sources

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Sun 09 Jan 2011 05:56:53 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Ben Abbott Open/Closed:  Closed
Release:  dev Operating System:  Mac OS

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Sun 09 Jan 2011 07:36:41 PM UTC, comment #6: 

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/21b5284fa78d

This seems to fix the problem for me and all tests pass, so I'm closing this report.  If there are new problems parsing functions as a result of this change, then please open a new bug report.

John W. Eaton <jwe>
Project Administrator
Sun 09 Jan 2011 07:00:33 PM UTC, comment #5: 

I'd prefer that they were coerced. But that's easy for me to say since I'm trying to run some code written for Matab and am asking someone else (you?) to do the work.

If it requires much effort, I'd say we should just turn the warning into an error.

Ben Abbott <bpabbott>
Project Member
Sun 09 Jan 2011 06:47:47 PM UTC, comment #4: 

I think things will work the same in 3.0.x as 3.2.x, but note that nested functions are not supported.  Previously, Octave would silently treat them as subfunctions.  For example, try this with 3.0.x:

function nested_functions (txt)
x = 1;
subfun1 (txt)
function subfun1 (txt)
   disp (txt)
   x
end
end

Calling this with

nested_functions ('foo')

I see

John W. Eaton <jwe>
Project Administrator
Sun 09 Jan 2011 06:26:10 PM UTC, comment #3: 

The part below ...

warning: nested functions are coerced into subfunctions

... seems to indicate that the nested functions would be treated as the unnested types. Which means no sharing of variables.

I don't have a 3.2.x version to run, but with 3.0.5 ...

octave:1> nested_functions ('test')
test

Should the warning be replaced by an error, or has this feature been reverted by mistake?

Ben Abbott <bpabbott>
Project Member
Sun 09 Jan 2011 06:11:14 PM UTC, comment #2: 

Nested functions are not yet supported.  This is not a change we will make before 3.4 is released.  Should we change the error message to be more explicit about this?

John W. Eaton <jwe>
Project Administrator
Sun 09 Jan 2011 05:58:22 PM UTC, comment #1: 

... trying a 2nd time.

With the following nested function ...

function nested_functions (txt)
subfun1 (txt)
function subfun1 (txt)
   disp (txt)
end
end

I get an error with the nested functions are coerced into unnested
subfunctions.

octave:3> nested_functions test
parse error near line 8 of file
/Users/bpabbott/Development/git/matlab2tikz/src/nested_functions.m

inconsistent function endings -- if one function is explicitly ended, so
must all the others

warning: nested functions are coerced into subfunctions in file
/Users/bpabbott/Development/git/matlab2tikz/src/nested_functions.m
error: parse error while reading function file
/Users/bpabbott/Development/git/matlab2tikz/src/nested_functions.m

Ben Abbott <bpabbott>
Project Member
Sun 09 Jan 2011 05:56:53 PM UTC, original submission:  

With the following nested function ...

Ben Abbott <bpabbott>
Project 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 bpabbott (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

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

    Back to the top


    Powered by Savane 3.5