default arguments to template's expressions
问题 If I want to make a template that can accept 2 untyped arguments, and pass them through do notation, when I omit the second do I'd like to have a way to specify a fallback in the form of a parameter's default value. as such: template tpl(x: bool, body: untyped, bodyFinally: untyped): void = if x: body else: bodyFinally #call site: var r: int tpl(true) do: r = 2 do: raise newException(Exception, "") This works, but that: template tpl(x: bool, body: untyped, bodyFinally: untyped = discard):