Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tolerate and pass through null from AND [...], OR [...]
The enfix AND and OR actions get some amount of flexibility from behaving differently if their right hand side is a GROUP! or a BLOCK!. Concept is that the right hand side is quoted, and then it is not run if the left hand side precludes the need to run it. GROUP! indicates the result should be forced to LOGIC!, and a BLOCK! indicates a more general willingness to take whatever type got evaluated to. This commit takes the difference a little further, by introducing null tolerance to the BLOCK! version. It's not legal to say `() or ()`, but it is legal to say `() or []`, thus producing a null result. This means falsey operations which use the BLOCK! on the right do not end up canonized to a BLANK! the way that an ALL or ANY would. So a falsey result (considering nulls falsey) will fall through unmodified. Someone can write: x: false x: me and [1 + 2] And x will be false...not a BLANK! as it would have been before. Or x: true x: me and [] This means that x will be null, not a BLANK! as it would have been before. The "ME AND" and "ME OR" patterns are motivating for the example, so that the state of the "me" variable is preserved instead of forced to a blank. This produces some truthy-oriented variations for DEFAULT. The consequences of this change are not yet well-understood, but given the relative recent addition of AND and OR it's worth trying.
- Loading branch information