Impelement `when` in Stencil language.

Closes #137.