[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What does "ans is no longer a built-in variable" mean?
From: |
John W. Eaton |
Subject: |
What does "ans is no longer a built-in variable" mean? |
Date: |
Wed, 24 Jun 2009 12:34:09 -0400 |
On 23-Jun-2009, Judd Storrs wrote:
| I'm porting some matlab code to octave and I've run into a warning that can
| be reproduced thusly
|
| octave:1> ans = 5
| warning: ans is no longer a built-in variable; please read the NEWS file or
| type `news' for details
|
| I'm having trouble understand this warning message. I looked through the
| NEWS{,.1,.2,.3} files and I couldn't identify the relevant section. My first
| thought was that octave was warning me that octave doesn't assign the result
| of the last evaluation to "ans". But that doesn't seem to be the correct
| interpretation:
|
| octave:1> sin(5)
| ans = -0.95892
| octave:2> ans
| ans = -0.95892
|
| ...besides the error occurs when you assign a value to a variable
| called
It's a warning, not an error, isn't it?
| "ans", not when you try to use it. After thinking about the message
| obliquely for a bit, I decided that maybe octave was trying to warn me that
| my assigned a value to "ans" would override the automatic value for the rest
| of the scope or session. But that also doesn't seem to be the correct
| interpretation either:
|
| octave:1> ans = 5
| warning: ans is no longer a built-in variable; please read the NEWS file or
| type `news' for details
| ans = 5
| octave:2> sin(5)
| ans = -0.95892
| octave:3> ans
| ans = -0.95892
| octave:4>
|
| Does anyone know what this warning is about?
It may have been that when I converted all the built-in variables to
functions, I thought that ans should also be converted to a function.
But I don't think that is the correct thing to do. I checked in the
following change.
http://hg.savannah.gnu.org/hgweb/octave/rev/68f4034d4e7e
BTW, what is a good reason to assign a value to ans directly?
jwe