RESO Rules: Empty values and COALESCE #85
bryanburgers
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve been reading through the RESO Validation Expression spec’s List of Functions and List of Operators and I can’t tell what should happen when an empty field is used in an operation.
Take, for example, the expression
7 + .EMPTY.
. Loosely typed programming languages tend to take either a very lax stance to something like this by automatically coercing values that don’t match (e.g.7 + null
is7
in JavaScript) or a strict stance (e.g.7 + None
is an error in Python). I can’t tell from the spec which camp RESO Validation Expression language falls into.1Are there any existing implementations that depend on one or the other interpretation?
If not, I propose that the expression language take a strict stance, and treat operations between unlike values, like
7 + .EMPTY.
as an error.I further propose we introduce a new function,
COALESCE
2, to explicitly handle what to do with empty values. This function would take any number of arguments, and return the first non-empty value.Right now, I have a lot of rules that use an
IIF
to do coalescing. They look roughly likeWith
COALESCE
, this would look more likeFootnotes
The spec does define what happens when adding floats and integers; those two are like-enough that that makes sense. Python, used as an example of taking a strict stance, also allows adding floats and integers. ↩
Name taken from Microsoft SQL Server; I'm open to other options. ↩
Beta Was this translation helpful? Give feedback.
All reactions