From bug-request at octave dot org Tue Aug 10 23:02:55 2004 Subject: Re: Strange parse error From: "John W. Eaton" To: Paul Kienzle Cc: octave bug mailing list Date: Wed, 11 Aug 2004 00:02:13 -0400 On 10-Aug-2004, Paul Kienzle wrote: | I tried every symbol on my keyboard after a command name on the | beginning of the line. Near as I can tell, it is a command if it is | followed by space so long as the first non-space character is not an | equals or parenthesis (open or closed). | | This means, for example, that "f+1" is "f()+1", but "f + 1" is | "f('+','1')". | | Also, quotes are processed in commands as they are in octave. So | "f x '+ 1' x" would be the same as "f('x','+ 1','x')". | | As far as I can tell, there is no way to expand a variable in a string | or | in a command, such as you would do with $x in a shell script. | | BTW, while you are considering lowering your standards re: command | handling, I still don't think it makes sense for Octave to completely support this "feature" without something like "mark_as_command" because even at the beginning of a line, "f + 1" is handled as "add (f, 1)" if "f" is a variable. So to make this work, you have to know when you are parsing an expression whether the symbol "f" is a function or variable. It can break eval for introducing new variable names. Well, that is rarely used, so why not? | I'll say again that I find the syntax | | ! some system command | | particularly convenient. What should we do about "!" as a negation operator? Discard it and force changing a lot of code? Or should we also lower our standards to the point where we parse "! expression" differently depending on whether the "!" appears at the beginning of a line? Should we accept the inconsistency because people rarely write things like ! some_expression ? :-/ 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 -------------------------------------------------------------