Back-to-Back Begemann!
This week, Ole Begemann talks about introducing an operator to aid interpolating optionals. Which is cool, but then he drops this tidbit:
The
@autoclosure
construct ensures that the right operand is only evaluated when needed, i.e. when the optional is nil.
I’d never thought of using @autoclosure
to enforce this sort of “short circuit” behavior before. Very clever!