[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Detecting Matlab or Octave

**From**: |
John W. Eaton |

**Subject**: |
Re: Detecting Matlab or Octave |

**Date**: |
Thu, 25 Jul 2002 13:49:43 -0500 |

On 25-Jul-2002, I wrote:
| [...] you could try something like __OCTAVE_VERSION__,
| which, unlike OCTAVE_VERSION, is supposed to be a constant that can't
| be modified (seems to be broken in 2.1.x, but that should be fixed
| shortly).
Ooops. I forgot that some time ago, I made a change so that built-in
"constants" could actually be modified, but they would return to their
original value when cleared.
I'm no longer sure what is the better behavior. So for now at least,
I plan to leave things unchanged. Octave will allow you to assign
values to these constants, thus shadowing their original values. You
can clear them to recover the built-in value, but you can't clear the
built-in value. For example:
octave2.1:6> __I__
__I__ = 0 + 1i
octave2.1:7> __I__ = 1;
octave2.1:8> __I__
__I__ = 1
octave2.1:9> clear __I__
octave2.1:10> __I__
__I__ = 0 + 1i
octave2.1:11> clear __I__
octave2.1:12> __I__
__I__ = 0 + 1i
Does this seem reasonable, or would some other behavior be better?
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
-------------------------------------------------------------