help-octave
[Top][All Lists]
Advanced

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

RE: Editing files, indexing operations...


From: Julian DeMarchi
Subject: RE: Editing files, indexing operations...
Date: Thu, 26 Dec 2002 09:31:10 -0500

Thank you John!

-----Original Message-----
From: John W. Eaton [mailto:address@hidden
Sent: Wednesday, December 25, 2002 6:18 PM
To: James Frye
Cc: address@hidden
Subject: Re: Editing files, indexing operations...


On 23-Dec-2002, James Frye <address@hidden> wrote:

| On Mon, 23 Dec 2002, John W. Eaton wrote:
| 
| > Why not just fix things so that Octave is compatible with Matlab?
| 
| Well, that would certainly be my preference :-)  Then the programs I have,
| which do work in Matlab, would also work in octave without me having to
| fiddle around with them at all, and I could get back to what I'm supposed
| to be doing.

After screwing around with nested functions most of yesterday trying
to do something that would be both compatible and better than what
Matlab does, I decided that it was too much trouble to have something
better, so I settled on compatibility only.  The changes are checked
in to the CVS archive.  Some notes:

  * For now, nested functions only work inside function M-files.  You
    still can't define nested functions on the command line or in a
    script file.  This restriction may change, but probably not for a
    while.  The primary goal of this change is to allow Octave to
    handle more code written for Matlab, and since Matlab doesn't
    support function definitions on the command line or in script
    files, I don't think this limitation is too bad at this point.

  * In function M-files, endfunction (or end) that matches a function
    keyword is no longer meaningful, so it is simply ignored.  This
    also means that code that used to be ignored (with a warning)
    after endfunction now considered part of the function.

  * If you use eval to define a function inside another function, it
    will not be considered to be a nested function.  It will still
    have global scope.  This may eventually change as well, but if it
    does, we will allow the old behavior by using evalin ('base', ...)
    or something similar.

  * I stored local functions in the global function symbol table by
    prepending the name of the parent function to the local function
    name (separated by a colon, so there can be no conflicts with
    existing function names), then modified the function lookup code
    to also use this name mandling scheme.

  * After executing the following function

      function parent ()
        ...
      function child ()
        ...
      <EOF>

    the output of "who" will show both "parent" and "parent:child" as
    currently compiled functions, but this does not make parent:child
    accessible except by calling parent.

I think the implementation is Matlab compatible, but if there are
problems, please report them.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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