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

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

[Octave-bug-tracker] [bug #55995] "continue" is dynamically, not lexical


From: Rik
Subject: [Octave-bug-tracker] [bug #55995] "continue" is dynamically, not lexically scoped - callable from functions without for loops
Date: Tue, 26 Mar 2019 12:27:26 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #55995 (project octave):

                  Status:          Ready For Test => Fixed                  

    _______________________________________________________

Follow-up Comment #9:

I think this is the right philosophical choice.  I tested with this file
tst_cont.m


1;

for i = 1:5
  disp ("Before");
  subfcn()
  printf ("Call #%d\n", i);
  disp ("After");
endfor

function subfcn ()
  break;
#  continue;
endfunction


which now shows 


parse error near line 11 of file
/home/rik/wip/Projects_Mine/octave-dev/tst_cont.m

  continue must appear in a loop in the same file as loop command

>>>   continue;
             ^

octave:1> tst_cont
parse error near line 11 of file
/home/rik/wip/Projects_Mine/octave-dev/tst_cont.m

  break must appear in a loop in the same file as loop command

>>>   break;


The two loop keywords are now treated identically.

Last request would be to change the error message to be more precise.  It is
notthe case that the keyword can occur in the same file as the loop command,
it actually needs to be within the same scope or syntactic block.  The test
script I used has continue in a subfunction which is within the same file, but
that is not good enough.

Also, should there be a note in the NEWS file about this change?  I hope
nobody is actually relying on this feature, but it might be good to point out
the change.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55995>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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