Home Manual Packages Global Index Keywords Quick Reference |
#### 1.3.7.1 Runtime errors Runtime errors in Yorick are often simple typos, like syntax errors:
    > theta = span(0,2*pi,200)
    > wave = sin(thta)*exp(-0.5*theta)
    ERROR (*main*) expecting numeric argument
    WARNING source code unavailable (try dbdis function)
    now at pc= 1 (of 23), failed at pc= 5
     To enter debug mode, type <RETURN> now (then dbexit to get out)
    >
Many errors of this sort would be detected as syntax errors if you had to declare Yorick variables. Yorick's free-and-easy attitude toward declaration of variables is particularly annoying when the offending statement is in a conditional branch which is very rarely executed. When a bug like that ambushes you, be philosophical: Minutely declared languages will just ambush you in more subtle ways. Other runtime errors are more interesting; often such a bug will teach you about the algorithm or even about the physical problem:
    > #include "damped.i"
    > theta = span(0, 6*pi, 300)
    > amplitude = damped_wave(theta, 0.25)
    ERROR (damped_wave) math library exception handler called
      LINE: 19  FILE: /home/icf/munro/damped.i
     To enter debug mode, type <RETURN> now (then dbexit to get out)
    >
What is an oscillator with a Q of less than one half? Maybe you don't care about the so-called overdamped case -- you really wanted Q to be 2.5, not 0.25. On the other hand, maybe you need to modify the `damped_wave` function to handle the overdamped case.