> On 16 Sep 2015, at 17:59, Alex Hall <
meh...@icloud.com> wrote:
>
>
>> On Sep 16, 2015, at 12:39, Jeremy Pereira <
jeremy.j...@googlemail.com> wrote:
>>
>> To me it looks like it is as expected. The value type in the dictionary is Optional<String> The subscript return value is the value type of the dictionary wrapped in an Optional i.e. Optional<Optional<String>>
>>
>> Why would you expect anything else?
>
> As I said, I get the logic, I just thought I'd check. The way I learned it, an optional can have either a value or nil, which is the whole point of optionals. No one ever told me that the non-nil value in an optional can be another optional, so I figured it could be relied on to always be a non-optional. I'd never seen it before, and had never run across it in reading anything or talking to others about Swift, so I never expected it to work that way. Basically, I just didn't realize that Swift supports letting an optional be the non-nil value of an optional. I wanted to check to be sure it wasn't something odd, or that I wasn't doing something wrong.
Yes I can see your point of view, but I’ve always looked at Optional as just a type (in fact it is a simple generic enum with two cases) and some syntactic sugar which is why its actual behaviour came as no surprise to me.