Post by cevingsome implementations [...] define a special value called "undefined"
in Scheme every value other than #f is considered "true"
I think this is the problem. Undefined must not be a value or any function which gets passed an undefined value must throw an error.
I don't think it's mentioned anywhere in any RnRS.
R5RS says this: |If the value of an expression is said to be ``unspecified,'' then the expression must evaluate to some object without signalling an error, but the value depends on the implementation; this report explicitly does not say what value should be returned."
Post by cevingMaybe this can be solved if the evaluation of "undefined" throws an error?
Some implementations that I tested produce a warning or an error when you're trying to use a one-armed if in the context that requires a value to be produced.
Post by cevingA value "undefined" can be either true or false, because it is not defined. If it behaves sometimes like true and sometimes like false, it gets spooky. It must not behave at all.
I haven't ever seen it behaving as #f anywhere. And indeed, the standard says:
"Of all the standard Scheme values, only #f counts as false in conditional expressions"
so if this value is distinct from #f, it cannot behave as #f.
(I know that Kawa makes a deviation there, and allows another value to be false in the context of "if",
namely the #!null value - which makes sense given its JVM interop, and which I personally found convenient,
although I realize that different people's opinions on that matter will vary)