草庐IT

tempLabel

全部标签

swift - 如果全局属性总是惰性计算,而局部属性从不惰性计算,那么惰性修饰符会修改什么?

TheSwiftProgrammingLanguage(Swift2.1)第248页的注释解释了以下内容:Globalconstantsandvariablesarealwayscomputedlazily,inasimilarmannertoLazyStoredProperties.Unlikelazystoredproperties,globalconstantsandvariablesdonotneedtobemarkedwiththelazymodifier.Localconstantsandvariablesarenevercomputedlazily.摘自:AppleInc