Proposal: allow member access operator to accept a Struct?
, Object?
, or Pair?
on the LHS
#684
Labels
K-discussion
(Kind) A discussion.
S02-needs-owner
(State) An issue that needs an individual to write an RFC.
T-types
(Topic) Issues related to the WDL type system.
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: