A blog about Swift and iOS development.

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!

Hit me up on twitter (@jemmons) to continue the conversation.

Latest | Archives | RSS