Radical New Debug Tool

new topic     » topic index » view thread      » older message » newer message

Proposal for debug tool:

When a . begins a line, it is considered debug code.

If the user puts 'with debug' at the top, code that begins with . is run.
When no declaration is made or 'without debug' is explicitly set, any line
of code that begins with a . is treated as a comment.

For example:

with debug

for t=1 to length(sql[2]) do
    .position(1,1)
    .puts(1,"Field 'NAME' is " & sql[2][t][3])
    run_query( "update people set name='" & sql[2][t][3] & "' where id = 3" )
end for

The two lines, position() and puts(), would be run in this case. Without
debug turned on, they would be treated as comments.

This avoids having to utilize this slower implementation:

for t=1 to length(sql[2]) do
    if DEBUG then
       position(1,1)
       puts(1,"Field 'NAME' is " & sql[2][t][3])
    end if
    run_query( "update people set name='" & sql[2][t][3] & "' where id = 3" )
end for

Of course, it doesn't have to be a '.'. But I would prefer a one-character-
in-length indicator that can be typed without the shift key.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu