From octave-maintainers-request at bevo dot che dot wisc dot edu Sat Feb 22 21:04:32 2003 Subject: Builtin variables [was Re: Bug#182000] From: Paul Kienzle To: octave-maintainers at bevo dot che dot wisc dot edu Cc: octave-maintainers mailing list Date: Sat, 22 Feb 2003 22:05:06 -0500 John W. Eaton wrote: >Finally, what if we had a way to install built-in variables in the >scripting language? Then we could move things like the initialization >of things like octave_config_info out of the C++ code and into the >startup files. > I'm in favour of doing as much as possible in m-files, and doing anything from outside octave that can be done in octave. Built-in variables are a little bit strange in that they appear automatically in every scope. Maybe they should be functions instead? They act like functions in that a change function is called with the new value. For a couple of my functions (e.g., edit.m) I tried to set up the equivalent of built-in variables for the arbitrary defaults by using global variables. This mostly works except that it is slightly inconvenient (you need to say global when initializing them from octaverc) and it pollutes the global space. Also, when I save a value to a file, all global variables are also saved in the file [is there a way to control this?]. Another approach would be property lists associated with symbols, so I could set the 'author' property on the edit symbol and edit could query that property. This won't work because edit isn't defined until it is called the first time, but I want to set the properties from octaverc. A third approach is to do the matlab like thing and call the function with property pairs and save the property values in persistent variables. This I can do now, but it is kind of ugly. Suggestions