Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

“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

rmdan profil fotoğrafı
rmdan1 yıl önce

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

Vincent Pradeilles profil fotoğrafı
Vincent Pradeilles1 yıl önce

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?

Michael Anton Fischer profil fotoğrafı
Michael Anton Fischer1 yıl önce

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.

Alejandro Estornell profil fotoğrafı
Alejandro Estornell1 yıl önce

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?

Vincent Pradeilles profil fotoğrafı
Vincent Pradeilles1 yıl önce

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.

checked profil fotoğrafı
checked1 yıl önce

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?

Mark Cornelisse profil fotoğrafı
Mark Cornelisse1 yıl önce

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

floating point profil fotoğrafı
floating point1 yıl önce

Awesome video! The actually useful click bait!

Brandon McConnell profil fotoğrafı
Brandon McConnell1 yıl önce

What lang is this?

CEEN profil fotoğrafı
CEEN1 yıl önce

definitely a clickbait bro

Benzer Videolar