You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the member access operator accepts Struct, Object, calls, and, as mentioned elsewhere in the spec, Pair.
However, it does not accept a Struct?, Object?, or Pair? and a type coercion from T? -> T rightfully does not exist.
As a result of this limitation, the spec and ecosystem tooling suggest calling the select_first function passing an array literal containing only the optional value e.g. select_first([x]). If x is None, then a runtime error is generated by the engine as defined in the spec for the select_first function.
To me, the select_first workaround seems overly verbose and incurs the overhead of a naive array value allocation and function call when x is not None just to access its members.
While I'm relatively new to WDL and I lack the historical context for the design of the member access operator, it seems like it could explicitly accept T? (where T is a type that is otherwise accepted for the member access operator) on the left hand side of the expression and raise a runtime error if the value is None. This would lead to better readability of WDL source too: x.y instead of select_first([x]).y, which would effectively have the same semantics.
The text was updated successfully, but these errors were encountered:
Currently the member access operator accepts
Struct
,Object
, calls, and, as mentioned elsewhere in the spec,Pair
.However, it does not accept a
Struct?
,Object?
, orPair?
and a type coercion fromT?
->T
rightfully does not exist.As a result of this limitation, the spec and ecosystem tooling suggest calling the
select_first
function passing an array literal containing only the optional value e.g.select_first([x])
. Ifx
isNone
, then a runtime error is generated by the engine as defined in the spec for theselect_first
function.To me, the
select_first
workaround seems overly verbose and incurs the overhead of a naive array value allocation and function call whenx
is notNone
just to access its members.While I'm relatively new to WDL and I lack the historical context for the design of the member access operator, it seems like it could explicitly accept
T?
(whereT
is a type that is otherwise accepted for the member access operator) on the left hand side of the expression and raise a runtime error if the value isNone
. This would lead to better readability of WDL source too:x.y
instead ofselect_first([x]).y
, which would effectively have the same semantics.The text was updated successfully, but these errors were encountered: