News for hackers. Stuff that matters.
Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by _hardwaregeek on Saturday April 27, 2019 @06:18PM (#19767976)
I agree that's confusing coming from an imperative context. The core misunderstanding here is that `let` is a binding, not a variable declaration. It's binding a name to a value, not creating a variable which can be modified. Therefore the `if let` example is saying "if we can bind the value inside the optional to a name", while the regular let example is just saying "bind the optional to x"
Re:What's Going Down at the Tiobe Index? Swift, Surprisingly by geophile on Sunday April 28, 2019 @10:15AM (#19771234)
I get all that, but in one case the type of the value bound to the declared identifier is T, and in the other case it is T?. To me, that violates The Law of Least Astonishment, but that is admittedly subjective.