[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in save
From: |
John W. Eaton |
Subject: |
Bug in save |
Date: |
Mon, 2 Feb 1998 16:34:17 -0600 |
On 21-May-1997, John W. Eaton <address@hidden> wrote:
| On 21-May-1997, Andreas Weingessel <address@hidden> wrote:
|
| | When assigning a value to the variable "e" this variable can not be
| | saved. The same is true for the variable named "pi". These two
| | variables are both defined in octave, but can be overwritten.
| |
| | Repeat-By:
| | ---------
| |
| | octave:1> e = 5
| | e = 5
| | octave:2> save xxx e
| | warning: save: no such variable `e'
| |
| | But "e" can be used with the new value.
| |
| | octave:3> e+3
| | ans = 8
| | octave:4> e
| | e = 5
|
| The problem is that built-in variables like this don't become normal
| user variables when the assignment happens. I don't see a simple fix
| for this problem, because some built-in variables should remain
| special evan after assignment.
|
| I don't think I'll be able to fix this for 2.0.6, but I'll try to do
| it for 2.1.
Well, it took a long time for me to see the simple fix for this
problem, but I finally did. From the message I just sent to
bug-octave:
The fix was to install all built-in `constants' (like i, j, e, pi,
etc.) as functions in the symbol table (doing this simply changes the
semantics of these symbols -- the overhead of a function call is not
actually required to evaluate them). The `constants' i and j have
always been installed as functions, but the others were not. I don't
remember why i and j alone were special and I can't think of any
reason that e or pi should be any different from i or j.
The semantics for built-in variables like `do_fortran_indexing' have
not been changed, so modifying them within a function will change the
global symbol value.
So now, you can do this:
$ src/octave
Octave, version 2.0.10 (i686-pc-linux-gnulibc1).
Copyright (C) 1996, 1997, 1998 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.
octave:1> e = 5
e = 5
octave:2> save xxx e
octave:3> clear e
octave:4> load xxx
octave:5> e
e = 5
octave:6> clear e
octave:7> e
e = 2.7183
octave:8> quit
Thanks,
jwe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug in save,
John W. Eaton <=