Just a note to warn unsuspecting REBOLers.

Consider the following. I want to 'switch based on the return value of a
function. If the function returns none, I don't want to do anything, but I
want to make it clear in the code that none is an acceptable value. I know I
can code this multiple ways, but I thought the following should have worked:

>> retval: curr-func
>> switch retval [none [print "val-none"] "abort" [print "val-abort"]]
== none

Notice that the == none is the value returned from 'switch, not the
execution of the none block. To further illustrate:

>> switch/default retval [none [print "val-none"] "abort" [print
"val-abort"]][print "val-default"]
val-default

Which was what I was getting in my program. I consider this a bug, but it's
easy enough to work around.

- Michael Jelinek

Reply via email to