[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nested functions?
From: |
Benjamin Abbott |
Subject: |
Re: nested functions? |
Date: |
Tue, 18 Feb 2014 16:28:35 -0500 |
> On Feb 18, 2014, at 4:24 PM, Mike Miller <address@hidden> wrote:
>
>> On Tue, Feb 18, 2014 at 14:29:55 -0500, Vic Norton wrote:
>> The file "outerfunc.m" consisting of
>>
>> 1;
>> function outerfunc()
>> global printhello = 1;
>> nested1();
>> function nested1()
>> global printhello;
>> if printhello
>> printf("hello world\n");
>> else
>> printf("goodbye world\n");
>> endif
>> endfunction
>> endfunction
>>
>> produces the "nested functions not implemented in this context" error
>> message in Octave 3.8.0. However, if you comment out the "1;" line, it
>> works fine:
>
> Right, that's what I meant by converting it to a function file, an
> m-file that defines a callable function versus a script file. If the
> first line (aside from comments) is a function definition, it is
> parsed as a function file, otherwise it is parsed as a script file.
>
>> It would be interesting to see how this file works in Matlab. I don't
>> particularly like the Octave behavior.
>
> Agree, if someone can test this in Matlab and post the results that
> would be helpful. You might go ahead and report this on the Octave bug
> tracker anyway.
Matlab doesn't support function functions defined at the command line or in
scripts (only in function files)
Ben
- nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?,
Benjamin Abbott <=
- Re: nested functions?, Mike Miller, 2014/02/18
- Re: nested functions?, Vic Norton, 2014/02/18
- Re: nested functions?, fork, 2014/02/19
- Re: nested functions?, c., 2014/02/19
- Re: nested functions?, Vic Norton, 2014/02/20
- Re: nested functions?, c., 2014/02/20
- Unmaintained packages on Octave-Forge, Jordi GutiƩrrez Hermoso, 2014/02/20
- Re: Unmaintained packages on Octave-Forge, c., 2014/02/20
- writing packages (Re: nested functions?), Vic Norton, 2014/02/20