Skip to content

Question mark operator for unwrapping optional values #551

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

K-request-for-comment(Kind) A request for comment (RFC).L-enhancement(Legacy) An enhancement to the WDL language.S06-voting-active(State) Changes for which voting is active.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