[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Static Variables (was: issue with user preferences)
From: |
John W. Eaton |
Subject: |
Re: Static Variables (was: issue with user preferences) |
Date: |
Mon, 11 Nov 2002 18:26:25 -0600 |
On 2-Nov-2002, Quentin Spencer <address@hidden> wrote:
| For what it's worth, I believe the Matlab variable type "persistent" is
| equivalent to a static variable (calling it "static" would have been too
| easy for them).
As most people can probably guess, I'm not a big fan of many of the
MathWorks' decisions about the design of Matlab, but in this case, I
think "persistent" is really a better word than "static". When I hear
"static variable" it sounds wrong -- wouldn't a static variable be a
"variable" that doesn't change (i.e., is constant)? Persistent
describes what is happening more clearly. OTOH, lots of people
(though maybe not Matlab users) have been exposed to C/C++ now, and
understand what "static" means, so why use a different term?
| I first used this about a year ago when working for an
| employer who insisted on Matlab (version 6 I believe). If someone can
| verify that this is in fact identical to a "static" in Octave, it
| shouldn't be difficult to add.
The docs on the MathWorks web site seem to indicate that they are
the same, and yes, it is trivial to add persistent as another way of
saying static.
Here is a patch, for the current CVS. It will probably apply OK to
other versions of Octave, but if not, it should be pretty easy to see
how to adapt for any version of Octave that already has static.
jwe
2002-11-11 John W. Eaton <address@hidden>
* octave.gperf: Allow "persistent" as a synonym for static.
Index: src/octave.gperf
===================================================================
RCS file: /usr/local/cvsroot/octave/src/octave.gperf,v
retrieving revision 1.8
diff -u -r1.8 octave.gperf
--- src/octave.gperf 26 Sep 2002 21:32:07 -0000 1.8
+++ src/octave.gperf 12 Nov 2002 00:18:40 -0000
@@ -66,6 +66,7 @@
gsplot, PLOT, gsplot_kw
if, IF, if_kw
otherwise, OTHERWISE, otherwise_kw
+persistent, STATIC, static_kw
replot, PLOT, replot_kw
return, FUNC_RET, return_kw
static, STATIC, static_kw
-------------------------------------------------------------
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
-------------------------------------------------------------