Receiver Closures

This approach is interesting, and I like it better than the alternatives so far (clearer while still concise, more flexible because it can be applied to any closure). I think the natural spelling would be

let website = html ${
    head ${ title = "Awesome Title" }
    body ${
      div ${ text = "div1" }
      div ${ text = "div2" }
    }
}

as an analogy to the shorthand argument names ($0, etc).

3 Likes