Video yükleniyor...
Video Yüklenemedi
“let is a lie, sometimes” Quite a bold statement, isn't it? 🤨 But I swear it's not clickbait: there are situations where using `let` doesn't guarantee that a value is impossible to change! Let me show you 😌
12,854 görüntüleme • 1 yıl önce •via X (Twitter)
10 Yorum

Turns out it's a clickbait. You changed the whole struct.

true, but there's no visible assignment at the call site. would have caught it during a code review, or if reading someone else's code?

There is no second best. To be the optimal medium of exchange and unit of account, it's best to not have to convert between different moneys. And since network effects grow exponentially with the number of users, once a certain user threshold has been passed, any new monetary technology has to be significantly better than the dominant one to replace it.

Well... You're still changing the whole `var myStruct` with a new instance. That's not different from: ``` var myStruct = MyStruct(value: "Hello, World!") myStruct = MyStruct(value: "Something else 😏") ``` Isn't it?

yes, it's conceptually equivalent. the big difference is that in the example I shared, there's no assignment sign visible at the call site, so it's super sneaky.

You totally misunderstood the concept and usage context of let properties or variables. It’s not for security purposes. If you want to prevent access there are proper ways of doing that. Do you want me to explain further?

reference types are pointers and the pointer is unmutable. Technically it's still correct.

Awesome video! The actually useful click bait!

What lang is this?

definitely a clickbait bro


