common-workflow-language / user_guide

The CWL v1.0 - v1.2 user guide
http://www.commonwl.org/user_guide/
Other
42 stars 67 forks source link

Topics > Inputs: Clarify the purpose of handling nullables in JS. #402

Closed zoe-translates closed 1 year ago

zoe-translates commented 1 year ago

It was never clear to me why the doc said you might need to use an **or** boolean operator and you must remember to use an or operator in your JavaScript expression when using exclusive parameters, or any parameter that allows `null`. The || operator isn't related to exclusive parameters by logical necessity; it's just one of the possible things we employ to handle the underlying problem, which I believe is the consistency of the underlying type when using the union (exclusive) type in general, and the nullable value (= union of the null type and some non-null type) in this specific incarnation here.

As a result I revised this part to basically say that, and added some explanation about why the || operator does the job for us in this case (because of JavaScript expression semantics).