While I see what you're going for, my initial reaction is that it's a bit too powerful for what's meant to be a convenience feature. The idea of using anything more than self
for implicit lookup seems potentially confusing to me, and if you really need to access self, you can just do so outside of the closure.
The ‘anonymous methods’ idea seems a much more direct solution to this problem with
is meant to solve; it's lightweight and much easier to reason about.
Other the other hand, the benefit of your solution is that it's perfect for DSLs, and as your example shows, it can be used to create a with
function/operator. If this is a problem we want to solve, it does make more sense to go in this direction, and turn with
into a library feature.