<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">It is not a bug. You must explicitly specify the variable's type if you use `lazy` keyword. `lazy` means the variable will be initialized later, but the compiler needs its type right now.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">Zhaoxin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 3:02 PM, Quinn "The Eskimo!" via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 12 Sep 2016, at 06:40, Jacob Bandes-Storch via swift-users <<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br>
<br>
> I'd recommend filing a bug at <a href="http://bugs.swift.org" rel="noreferrer" target="_blank">bugs.swift.org</a>.<br>
<br>
</span>Agreed.<br>
<br>
Also, you can work around this by adding a type.<br>
<br>
lazy var myQ: DispatchQueue = DispatchQueue(label: "Op", attributes: .concurrent)<br>
<br>
Also, with regards this specific example, be aware that lazy properties aren’t guaranteed to be initialised only once. To quote “The Swift Programming Language”:<br>
<br>
If a property marked with the `lazy` modified is accessed by multiple<br>
threads simultaneously and the property has not yet been initialized,<br>
there is no guarantee that the property will be initialized only once.<br>
<br>
I’m struggling to think of a case where that limitation is acceptable in the context of a dispatch queue (-:<br>
<br>
Share and Enjoy<br>
--<br>
Quinn "The Eskimo!" <<a href="http://www.apple.com/developer/" rel="noreferrer" target="_blank">http://www.apple.com/<wbr>developer/</a>><br>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
</div></div></blockquote></div><br></div>