>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Rel
Voc
!:
wd
Help
Primer
Debug - an error
Let's introduce an error into your centigrade verb to see how that looks and how you would find and fix it.
Open your cf.ijs script and edit the first line to have an error by adding quotes around the expression to the right of the copula.
t1 =. 'y - 32'
Instead of t1 being defined as the result of y - 32 , it will be defined as the string.
Run the script to make the new definition. Turn off debug suspension and request no stops and then run your buggy centigrade. Be sure to load the debug utilities if they are not already loaded.
dbr 0 NB. disable suspension
dbss ''
centigrade 212
¦domain error
¦ t2=.t1 *5
You are executing with suspension disabled (dbr 0) so execution did not suspend in centigrade and you have the normal 3 space indent.
If you look at the line in error it is clear that the 5 is a valid argument to times, so there must be something wrong with t1. But you don't know the value of t1. You could stare at the source for the error, but, in a complex situation, it might be quicker to use debug.
Enable suspension and rerun.
dbr 1 NB. enable suspension
centigrade 212
¦domain error
¦ t2=.t1 *5
¦centigrade[1]
There is a 6 space indent indicating suspension, and because centigrade is suspended you can look at the value of t1.
t1
y - 32
From the display of t1 it is clear that it is a string, not the number from the desired calculation. You can now look at the source to see where t1 was defined and see that the quotes should not be there.
Edit the source to fix the definition by removing the quotes and run the script to redefine centigrade.
You want to run line 0 again to properly define t1. You can do this by using dbjmp to continue execution at line 0.
dbjmp 0
100
Since no stops are set and there are no other errors, line 0 of centigrade is executed, which sets a proper value into local t1 and execution continues until finished.
>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Rel
Voc
!:
wd
Help
Primer