[swift-evolution] Removal of dispatch_once() in Swift 3?

Charlie Monroe charlie at charliemonroe.net
Thu Jun 16 23:38:11 CDT 2016


> On Jun 16, 2016, at 11:30 PM, William Shipley <wjs at mac.com> wrote:
> 
>> 	private lazy var floorGeometryAndMaterialBacking: FloorPlatonicGeometryAndMaterial? = 
>> 				try! FloorPlatonicGeometryAndMaterial(modelDirectory: self.modelDirectoryURL)
> 
> Oddly, the “self.” made all the difference in getting it to compile. I’m not clear why in this case, I guess there’s some part of the language I didn’t learn right. Thanks.

Yes, another headache that would be solved by the explicit self!

The issue here is often (in my experience) that if the closure/one-liner defining the default lazy value contains an error, the compiler won't emit an error about the actual cause but will compain very generically it can't assign.

You might consider reporting it on bugs.swift.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160617/401c841d/attachment.html>


More information about the swift-evolution mailing list