help-octave
[Top][All Lists]
Advanced

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

Multiple functions in a file


From: John W. Eaton
Subject: Multiple functions in a file
Date: Tue, 21 Nov 2000 12:53:52 -0600

On 10-Nov-2000, Andy Adler <address@hidden> wrote:

| Is it possible to put multiple function
| definitions in a single *m file.
| 
| ie. could I do something like this,
| and access foo from the outside
| 
| --------begin file foo.m-------
| function x=foo(y)
|   x= 1+bar(y);
| endfunction
| 
| function a=bar(b)
|   a=b^2;
| endfunction
| --------end file--------
| 
| This code doesn't seem to work as is. 
| But I'd really like to be able to do this,
| as I don't want people to bar to be accessible directly.

No, Octave doesn't support this kind of scoping.  The symbol table and
associated functions would probably need some significant redesign to
handle it.  If someone is interested in implementing this, then please
consider designing some real support for namespaces instead, and then
implement this feature using the namespace capabilities.

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
-------------------------------------------------------------



reply via email to

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