help-octave
[Top][All Lists]
Advanced

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

Re: 3.8 qualification


From: Mike Miller
Subject: Re: 3.8 qualification
Date: Wed, 23 Jul 2014 11:10:16 -0400

On Tue, Jul 22, 2014 at 20:25:40 -0400, Vic Norton wrote:
> I'm writing a paper that will be supported by an Octave package. For
> me there is a huge difference between Octave 3.8 and prior versions of
> Octave. Does the following qualification make any sense to anyone? Any
> suggestions as to how I should phrase it?
>
>
> The dxneg function is the main subroutine. In outline it looks like
> this.
>
>    function [P, Lambda, do_again] = dxneg(X, Y, do_again)
>      # global j0 J K q Q R A b; # uncomment for Octave versions < 3.8
>        ... <code> ...
>      # endfunction  # dxneg  # uncomment for Octave versions < 3.8
>
> The “global” variables in the second line of the dxneg outline need
> not be declared since these variables occur only inside dxneg and
> inside subroutines of dxneg. In versions of Octave prior to 3.8, the
> first hash mark in the second line of dxneg would have to be removed;
> this would make the “global” variables truly global in scope. And this
> would be necessary, in versions of Octave prior to 3.8, because all
> subroutines in these versions have global scope. But this is a
> technical point; let’s forget it.

It's a little unclear from this edited view of your project, but I
assume you are talking about nested functions in Octave 3.8. This is
described in the NEWS file. If you don't end a function, subsequent
functions are defined in the scope of the first function and they have
access to all of the outer function's variables. If that's what you're
looking for, the terminology to describe this change, it's nested
functions.

The part that was unclear to me in your outline is that your function
dxneg is followed by other functions that share a set of variables. If
this could be made clearer, then I think the need for the global
declaration would be more obvious.

HTH,

-- 
mike



reply via email to

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