<div dir="ltr">I&#39;ve spent some time exploring different aspects of the language&#39;s type system and came across a case where I wanted to know the type of the thing an optional might hold, if it exists. The direct type of an optional variable is, unsurprisingly, an optional:<div><br></div><div>&gt; var example: String? = &quot;example&quot;</div><div>example: String? = &quot;example&quot;</div><div>&gt; example.dynamicType</div><div>$R1: String?.Type = String?</div><div><br></div><div><br></div><div>Ok, that didn&#39;t work. What if I dereference?</div><div><br></div><div>&gt; example!.dynamicType</div><div>$R2: String.Type = String</div><div><br></div><div>Ok. What if the optional doesn&#39;t currently have a value? Does this still work?</div><div><br></div><div>&gt; example = nil</div><div>$R3: String.Type = String</div><div><br></div><div>That&#39;s odd. I expected it not work, given how forced unwrapping of nil optionals usually turns out.</div><div><br></div><div>Is this explicitly intended behavior, something that really shouldn&#39;t work and shouldn&#39;t be relied on, or... other?</div><div><br></div><div>Mike</div></div>