执行时
do-file: func[file][
if error? error: try [
if (find [%.r %.cgi] (suffix? file)) [
do file
]
][
disarm error
print ["error executing " file]
input
]
]
foreach-file: func [
"Perform function on each file in selected directory recursively"
dir [file! url!] "Directory to look in"
act [function!] "Function to perform (filename is unput to function)"
/directory "Perform function also on directories"
/local f files
][
if not equal? last dir #"/" [
dir: to-rebol-file join dir #"/"
]
files: attempt [read dir]
either none? files [return][
foreach file files [
f: join dir file
either dir? f [
either directory [
act f
foreach-file/directory f :act
][
foreach-file f :act
]
][act f]
]
]
]
feach-file %test/ :do-file
其中 %test 将包含一个只有 rebo 标头的文件:
rebol []
程序因错误而停止,而不是解除错误!
如果文件包含类似的内容,它不会给出错误
rebol []
test: context []
但如果它包含它会再次失败
rebol []
print ""
为什么 ?