Swift @autoclosure and Lazy Evaluation

February 12, 2015

Wow, this is a bit late to the party, but I just read about Swift’s @autoclosure attribute on Apple’s Swift blog.

It’s mentioned in the context of assert functions, but using it to allow users to create lazy-evaluation functions, a la ||? Mind. Blown.

Also, the description caused a subtle shift in my understanding of closures, in the context of “lazy evaluation.” Gonna have to sleep on that!

Tags: swift
comments powered by Disqus