Re: [q-lang-users] Newbie questions and comments
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2005-03-18 11:52:22
|
Tim Haynes wrote: > | public plot, pi, degsgran, circle, blob; > | > | def pi=4*atan 1; > > PI is a useful thing to have, of course, but with a typo like the above > (failure to remove the leading `def' whilst converting to lowercase) I get > > | zsh, trough 8:08PM scot-pics/ % ./map.q > | ! Value mismatch in definition Yes, but the error message is correct: The def will try to match 3.14... against the function symbol pi, and this fails. > with no file:line-number, and, critically, execution continues regardless. Hmm, yes, the portion of the interpreter which executes the init code is a bit simplistic right now. The byte code of an initialization should contain a reference to the corresponding source line (IIRC that's not the case right now), then the interpreter could give more useful feedback. But what would the proper behaviour for a failed match in a def be? Really exit the interpreter? Raise an exception? I think that right now the interpreter simply abandons execution of the remaining init code of the script but continues to the read-eval-print loop anyway, so that you can try to find out what went wrong. I think that this behaviour is appropriate when running in interactive mode, but I agree that it's not very useful in batch mode. Ok, maybe that's a nice opportunity to try out the (still virgin) Bug tracker at http://sourceforge.net/projects/q-lang/ ;-) If you have the time, please enter a bug report there, then I'll see what I can do about this for the next release. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikwissenschaft.uni-mainz.de/~ag |