Skip to content

Question mark operator for unwrapping optional values #551

@jdidion

Description

@jdidion

This is purely syntactic sugar for select_first([x]) where x is a value that may be None.

Int? x = 5
Int x1 = x?
Int? y = None
Int y1 = y?  # error

If we add this operator then we can get away from special-casing optional behavior within string interpolations. I.e. "~{x + y}" would no longer be allowed (i.e. deprecated in 1.2 and disallowed in 2.0) and instead you'd have to write "~{x? + y?}", just as you would in an expression outside of an interpolation.

Metadata

Metadata

Assignees

Labels

K-request-for-comment(Kind) A request for comment (RFC).L-enhancement(Legacy) An enhancement to the WDL language.S05-in-progress(State) A task that is in progress.Z-specification-change(Metadata) An issue or PR related to a specification change.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions