[REBOL] Re: to-string do question?
From: carl:cybercraft at: 24-Dec-2003 22:24
On 23-Jul-03, bryan wrote:
> [>> err: error? try [
> [ returnstring: to-string do "write %newfile.txt read %rlt.txt" [ ]
> == true
>>> ? err
> ERR is a logic of value: true
> Isn't that what you get? Or have I misunderstood something? ]
> yeah that is what I was getting but the error handling I was looking
> for was a little finer grained.
> Basically what I want to do is to:
> do thestring
> thestring could be many different things, it could be nonsense such
> as "uauiouasdhis" which is an error because I have not set that word
> to be anything or it could be "write %newfile.txt read %rlt.txt"
> which is an error because %rlt.txt doesn't exist or it could be
> "write %newfile.txt read %oldfile.txt" which is not an error but
> does not allow one to change the result of do to-string and it could
> be "1 + 4" which is correct and does allow one to change the result
> of the do to a string.
> See the problem is that the error 'to-string do thestring' can be a
> different error than 'do thestring'. I obviously don't want to check
> to see if 'do thestring' raises an error and if it does not then
> check if 'to-string do thestring' raises an error.
Ah - with you now. You could include the other checks in the try
block and use...
make error! "error name"
if an error does occur. That would then be treated just like the
> Of course Gabriele came with an answer, but it seemed way to complex
> for an article the main focus on which is Asynchronous Pluggable
> Protocols, and uses simple Rebol to show how one can extend Windows
> via an APP.
Yes - examples should include as little unrelated code as possible.