[REBOL] Re: idea for pre-processing
From: nitsch-lists:netcologne at: 20-Jun-2002 20:16
Am Donnerstag, 20. Juni 2002 05:50 schrieb Anton:
> The following two lines work the same:
>
> do %demo-trapezoid-morph.r
> do read %demo-trapezoid-morph.r
>
> This means that you can make a wrapper around
> 'do which will allow you to pre-process the file
> before it is run.
>
> Why?
> I want to optionally strip debugging lines in my
> programs, so that they run at top speed without
> them. There will be no overhead of, eg:
>
> if debug [print "inner loop"]
>
> which could occur multiple times in a program,
> and within tight, inner loops, impacting
> performance.
>
> The reason I have come to this idea was in
> image processing.
>
> Has anyone done something like this?
>
another option could be
;when debugging
debug: :do
debug [print "inner loop"]
;when released
debug: none
debug [print "inner loop"]
could be a little bit faster.
or you could process the loaded source with
src: copy/deep orig: [a b debug [c] [1 2 debug [3 4] 5 6] [debug [?]] e f]
no-debug: func [src] [
rule: [
any [
begin: 'debug block! :begin (remove remove begin)
| into rule
| skip
]
]
parse src rule
src
]
no-debug src
? src
? orig
and
do no-debug load %file.r