Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Else statements #697

Open
claymcleod opened this issue Jan 20, 2025 · 2 comments
Open

Else statements #697

claymcleod opened this issue Jan 20, 2025 · 2 comments

Comments

@claymcleod
Copy link
Collaborator

I recently discovered that WDL does not have else statements. To achieve the same effect, it's suggested by the spec to use two if statements: one with the conditional you desire, and then one with the negated conditional.

Searching through the issues, I didn't immediately find an explanation as to why we can't have else statements. Is there a good reason for this that I just can't find?

@geoffjentry
Copy link
Member

I actually remember this one.

It's because there were a lot of strong motivating use cases (in terms of scientific workflows people were actually trying to run at the time) for "optionally run a task" but very few for deeper branching logic. Because that impact prioritization plus how it would complicate both WDL & implementation and that "design a full programming language" was an explicit non-goal we left it at just the if.

Most of these boil down to some form of there not being enough of motivating use cases to be worth the extra effort. Sometimes this was IMO for the better (e.g. the lack of loops: 10 years later and still doesn't come up hardly at all) and some for the worse (e.g. Pair which only exists as a half-ass on richer object types due to key use cases at the time only needing pairs of things)

@claymcleod
Copy link
Collaborator Author

claymcleod commented Jan 20, 2025

Yeah that totally makes sense, thank you for the context and the history here.

I don't know if you've been following the work I'm doing on the wdl-docs repository, but I definitely think that this minimalism is a strength (in particular, this section). I totally agree on loops that they are probably not needed.

Though I 100% agree that WDL should remain simple and should not often "purchase" flexibility at the cost of more complexity, to my eye, else would add a relatively very small amount of complexity while enabling a moderately useful design pattern in a more straightforward way. For example, doing things like in the the second example here are probably going to be much more straightforward with an else clause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants