Clarify if defined()
should provide type narrowing.
#709
Unanswered
multimeric
asked this question in
Ideas
Replies: 1 comment 1 reply
-
I don't think making an optional implicitly non-optional because it happens to be in a if-then-else with Besides, WDL already has a function that achieves this exact effect: Int? optional
Int x = select_first([optional, 0]) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Originally brought up here: chanzuckerberg/miniwdl#720.
Basically, it would be intuitive for
defined()
to narrow aT?
toT
in the type system, and make this legal WDL:However, I'm guessing that this isn't clarified because WDL doesn't have the idea of type guards as this is the only function of its kind.
I wonder what implementations should do here, and if the spec could clarify? This also might be a chance to consider if type guards could be useful.
Beta Was this translation helpful? Give feedback.
All reactions