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

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

[Octave-bug-tracker] [bug #32083] nested functions and developers source


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #32083] nested functions and developers sources
Date: Sun, 09 Jan 2011 18:47:48 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101028 Iceweasel/3.5.15 (like Firefox/3.5.15)

Follow-up Comment #4, bug #32083 (project octave):

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


-foo
error: `x' undefined near line 6 column 4
error: called from:
error:   /scratch/jwe/build/octave/nested_functions.m at line 6, column 4
error:   /scratch/jwe/build/octave/nested_functions.m at line 3, column 2
octave3.2:2> type nested_functions
nested_functions is the user-defined function defined from:
/scratch/jwe/build/octave/nested_functions.m
verbatim-

But I see now that the functions are no longer being properly coerced and
instead that there is a parse error.

So, should we just fail for nested functions, or coerce them to subfunctions
(some may work that way, some will not).  In your example, they all do have
"end" statements, so the error seems wrong.  But I think we should still warn
about functions that are recognized as nested but actually handled as
subfunctions.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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