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

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

[Octave-bug-tracker] [bug #51698] Nested function fails to inherit a var


From: anonymous
Subject: [Octave-bug-tracker] [bug #51698] Nested function fails to inherit a variable created with assignin
Date: Wed, 9 Aug 2017 13:26:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36

Follow-up Comment #7, bug #51698 (project octave):


Does this mean that things like these will stop working? In the example below,
I use _setM to set M. _callsub works on a separate K. 

But, main() still wants to rely on _setM for setting a separate M. 

In other words, I was very happy with your explanation and understood that
_callsub() won't have access to M, and that nested functions should only work
on K's set within the body.
But, my main() still wants to rely on _setM to set a lot of other /unrelated/
M variables. Will that now stop working? :(

<verbatim>
function main();
  _setM();
  (do stuff with M here)

  K = 2;
  _callsub_on_K();

  function _callsub();
           K +=3 ; 
  endfunction
  
endfunction


  
function _setM();
  assignin("caller", "M", 1);
endfunction
</verbatim>


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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