bugGNU Octave - Bugs: bug #34814, persistent variables in private...

 
 

bug #34814: persistent variables in private functions aren't persistent

Submitted by:  Patrick Gosling <jpmg>
Submitted on:  Sun 13 Nov 2011 09:39:11 PM UTC  
 
Category: InterpreterSeverity: 5 - Blocker
Priority: 5 - NormalItem Group: Other
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.4.3Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 23 Nov 2011 03:17:41 AM UTC, comment #1:

I checked in the following change which appears to fix the problem for me:

http://hg.savannah.gnu.org/hgweb/octave/rev/0ec8413d4bbc

If you need the fix you can build from Mercurial sources. See the download page (http://www.gnu.org/software/octave/download.html) for getting the sources.

Alternatively, the 3.6.0 release is scheduled for a December 2011 release and it will have the fixed code.

John W. Eaton <jwe>
Project Administrator
Sun 13 Nov 2011 09:39:11 PM UTC, original submission:

If a function in a private directory has a local variable declared "persistent", then it isn't as persistent as it should be.

If the function is called multiple times within a calling function, then persistence of the variable will be observed.

But if the outer function is called multiple times, the variable will be re-initialised on the first occasion that the inner function is called within each call of the outer function.

So, if I create ./private/f.m containing

and additionally create ./testit.m containing

then if in octave I run

I will get the result

whereas I would expect to get (and would get if f() wasn't private, but was in the current directory),

I can't see any good justification for this non-orthogonality - persistence shouldn't become temporary just because a function is private, surely? But before I start poking at the code to see if I can see an obvious fix, is there a reason I haven't thought of for this behaviour?

Patrick Gosling <jpmg>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by jpmg (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Nov 2011 03:17:41 AM UTCjweStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 15 Nov 2011 11:26:13 AM UTCjweSeverity3 - Normal=>5 - Blocker
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1