[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Variables with same name as functions. trouble!
From: |
Joao Cardoso |
Subject: |
Variables with same name as functions. trouble! |
Date: |
Wed, 20 Oct 1999 19:57:30 +0100 |
hi,
I spent several hours (dummy!) debugging some old scripts where it
happened that I used variables with the same name as script/builtin
functions. The error message is cryptic, and does not point to the
correct source line where the problem is. Of course this is a (bad)
programmer issue, but I suggest that, whenever a function name is
overwritten with a variable, a warning message be output.
The following script illustrate the problem:
function po
error=[1,2,3];
error("This is an error!\n")
endfunction
octave:76> po
error: string type invalid as index value
error: called from `po' in file `/u/qual/src/misc/po.m'
If the script where several dozen lines long, it would be difficult to
find the problem...
With the 582 script files in the standard octave-2.1.14 distribution it
is easy to make such a mistake.
Thanks,
Joao
--
Joao Cardoso | e-mail: address@hidden
INESC, R. Jose Falcao 110 | tel: + 351 2 2094322
4050 Porto, Portugal | fax: + 351 2 2008487
---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL. To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------
- Variables with same name as functions. trouble!,
Joao Cardoso <=