[Pitch #2] Function builders

You'll get an error. If a buildFinalResult is declared, we'll form a call to it; if that call fails to type check, it's an error in the program. Whether it's an error in the function builder itself (wrong signature, etc.) or in the function body (used the DSL wrong and the type checker caught it). Same thing with any other function. buildExpression is perhaps the most interesting, because you can use it to say what values are allowed in your DSL. SwiftUI's ViewBuilder, for example, requires all values to conform to View.

Doug

1 Like