Posts: 3,368
Threads: 195
Joined: Jan 2003
There should be a metacommand that can act either globally or locally that says label X, Y, Z, etc. are debug lines, label A, B, C, etc. are release lines, and then say either release or debug.
Example:
Code:
metaCompile debug 1 2 3 4 5 6 7
metaCompile release 8 9 10 11 12 13 14
metaCompile bunny 15, 16, 17
state release = 1
state bunny = 1
1 PRINT "hi"
2 END
3
4
5
6
7
8
9 PRINT "bye"
10 END
11
12
13
14
15 Print "BUNNY!"
16 END
17
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,272
Threads: 36
Joined: Feb 2003
Yuck. I think C style conditional compilation would be easier to use.
Code:
CONST FALSE = 0, TRUE = NOT FALSE
CONST DEBUG = TRUE
'$IFTRUE: DEBUG
PRINT "This is the debug version"
'$ELSE
PRINT "The is the release version"
'$ENDIF
Posts: 3,368
Threads: 195
Joined: Jan 2003
No, it wouldn't.
You'd have to hunt for everything.
And you'd have to keep repeating stuff.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 6,419
Threads: 74
Joined: Mar 2002
I prefer sterling's sollution. Very similar to C.
Agamemnus, your sollution with a program with 10,000 lines would require enormous lists of numbers. Also, if you use line numbers that way, when you insert a line all goes mangled.
Posts: 3,368
Threads: 195
Joined: Jan 2003
doesn't have to be in order.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 691
Threads: 5
Joined: Apr 2002
I like the C style approach also. You dont have to worry about hunting for everything either because most C preprocessors have arguments to set only some macros and display all of the code that would be included or excluded with those macros set.
With your approach and a very large program, it would be difficult to figure out which lines were being included (especially if they were not in order) because you would need to get the list of lines and then go looking for them (really hard if they are unordered).
esus saves.... Passes to Moses, shoots, he scores!
Posts: 1,272
Threads: 36
Joined: Feb 2003
At the very least it should be "metaCompile debug 2 TO 40, 100 TO 1003" or something like that, so that an exhaustive list of line numbers isn't required...
Posts: 3,368
Threads: 195
Joined: Jan 2003
I think you are misunderstanding me.
The example with line numbers could be replaced with "cat", for instance. They're just labels, not actual line numbers.
Also, I was thinking that one-liners are all that is necessary, since the things that one would want to put in debug mode are one-liners for me. Specifically error catching.
I suppose that one could include both ways to include debug code.
I always torment myself about it: if the error isn't going to happen if there aren't any bugs, should I write the code anyways? :|
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.