Theo - t3․gg
Theo - t3․gg
  • 444
  • 34 385 806
`const` was a mistake
Finally sharing my thoughts on the Const vs Let debate.
Ugh.
Original rant (unlisted for now)
ua-cam.com/video/LAd3zMw7_9c/v-deo.html
SOURCES
www.epicweb.dev/talks/let-me-be
cramforce/status/1786608749354082455
github.com/TodePond/DreamBerd/tree/main?tab=readme-ov-file
www.joshwcomeau.com/javascript/the-const-deception/
Check out my Twitch, Twitter, Discord more at t3.gg
S/O Ph4se0n3 for the awesome edit 🙏
Переглядів: 8 987

Відео

Deploying On Fridays
Переглядів 20 тис.6 годин тому
Shoutout to Vercel and PlanetScale for sponsoring the channel and letting me deploy with WAY less stress. Build safety nets, not guard rails 🫡 Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
React Just Changed Forever
Переглядів 133 тис.9 годин тому
React Conf just happened, and it's been a wild ride. React 19 is out, but that's old news. We're here for something almost forgotten, something I've wanted for awhile. The React Compiler is here. I'm so hyped. SOURCES playground.react.dev react.dev/learn/react-compiler ua-cam.com/video/PYHBHK37xlE/v-deo.html github.com/facebook/react/pull/29061 Check out my Twitch, Twitter, Discord more at t3.g...
How was this not in the browser before???
Переглядів 76 тис.11 годин тому
UA-cam DESTROYED MY DESCRIPTION WTF Popover API is so overdue and I'm pumped it's here. Popper and FloatingUI carried us this far, but the future of tooltips is bright SOURCES developer.mozilla.org/en-US/docs/Web/API/Popover_API chancethedev/status/1789037040161747361 web.dev/blog/popover-api codepen.io/web-dot-dev/pen/RwOvjrv developer.chrome.com/blog/anchor-positioning-api Ty Ph4s...
This Release Makes Me Want To Leave React...
Переглядів 118 тис.16 годин тому
Seriously. Elixir has always been my guilty pleasure and LiveView makes me rethink everything. Aaaaaaaaaa. So cool. Phoenix is dope and makes functional programming in a rails-like env fun SOURCE phoenixframework.org/blog/phoenix-liveview-1.0-released Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
AWS S3 Is Having Some Serious Issues...
Переглядів 53 тис.21 годину тому
The slow death of S3 has been happening for awhile now. As AWS's first service, it was kind of inevitable. So much so that I started an alternative. Speaking of that - uploadthing.com ;) SOURCES medium.com/@maciej.pocwierz/how-an-empty-s3-bucket-can-make-your-aws-bill-explode-934a383cb8b1 jeffbarr/status/1787844682216792163 Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4...
The End Of StackOverflow
Переглядів 78 тис.23 години тому
StackOverflow is being eaten by ChatGPT. Now it's desperately trying to catch up. Will this be the end of StackOverflow (and maybe the rest of the internet)? Idk man I just talk about stuff and write code SOURCES StackOverflow/status/1787467736097939562 t3dotgg/status/1787596365008380306 observablehq.com/@ayhanfuat/the-fall-of-stack-overflow Check out my Twitch, Twitter,...
CSS Is 2.4x Slower Than Inline Styles (Oh No...)
Переглядів 65 тис.День тому
I hate to share this with you all. But if I have to have this cursed knowledge, so do you. Inline styles being faster than CSS is not too surprising. The speed difference, however, is a bit insane. SOURCE danielnagy.me/posts/Post_tsr8q6sx37pl Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
React's New Controversial Override
Переглядів 50 тис.День тому
Oh boy. This again. React is patching another global, this time it's `Date` SOURCE acdlite/status/1785691330988986587 Edited by Ph4se0n3
The Problem With UUIDs
Переглядів 148 тис.День тому
THANK YOU PLANETSCALE FOR SPONSORING THIS VIDEO UUID's have a time and place, but I rarely see them used correctly. I've wanted to do this rant for awhile and I'm happy I did because CUID2 is NOT a good option either 🙃 SOURCE planetscale.com/blog/the-problem-with-using-a-uuid-primary-key-in-mysql Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
“California Skater Boy” Reacts To Senior JS Interview
Переглядів 42 тис.День тому
“California Skater Boy” Reacts To Senior JS Interview
React Removes `fetch`
Переглядів 69 тис.14 днів тому
The React "fetch" patch was controversial, but I genuinely liked it. That said, I understand why it's being removed, at least for now. SOURCES sebastienlorber/status/1783114423894233235 github.com/facebook/react/pull/28896 nextjs.org/docs/app/api-reference/functions/unstable_cache Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
Life After SQL (EdgeDB Is Fascinating)
Переглядів 52 тис.14 днів тому
Disclaimer: I am an advisor for EdgeDB, I do not ship it in production (I still build my services on PlanetScale) EdgeDB is getting pretty dang exciting. The idea of a "more relational" db is something I hadn't thought about enough before. Excited to see what they cook! SOURCES edgedatabase/status/1782485844814647402 www.edgedb.com/blog/we-can-do-better-than-sql#null-a-bag-of-surpri...
AWS’s Future is…Q?
Переглядів 37 тис.14 днів тому
I...idk what I expected. But I'm a bit tired of these weird AI announcements in places they don't necessarily make sense. Can I blame Devin? SOURCES ajassy/status/1785293612835823716 leeerob/status/1785498474462560309 Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
Dear GitHub, Why Did You Release This?
Переглядів 61 тис.14 днів тому
My lord, GitHub Copilot Workspace is a total disaster. Devin tier. I can't believe they are showing this off in such a terrible state. SOURCE github.blog/2024-04-29-github-copilot-workspace/ supermaven.com/ Check out my Twitch, Twitter, Discord more at t3.gg S/O Ph4se0n3 for the awesome edit 🙏
Was I Wrong About Rust?
Переглядів 62 тис.14 днів тому
Was I Wrong About Rust?
Pretty much every website uses the wrong font size…
Переглядів 59 тис.14 днів тому
Pretty much every website uses the wrong font size…
NodeJS 22 Just Dropped, Here's Why I'm Hyped
Переглядів 84 тис.14 днів тому
NodeJS 22 Just Dropped, Here's Why I'm Hyped
OpenELM: Apple's New Open Source LLM (OpenAI Competitor?)
Переглядів 71 тис.21 день тому
OpenELM: Apple's New Open Source LLM (OpenAI Competitor?)
This should have happened years ago...
Переглядів 28 тис.21 день тому
This should have happened years ago...
IBM Just Made A REALLY Weird Acquisition...
Переглядів 43 тис.21 день тому
IBM Just Made A REALLY Weird Acquisition...
React 19 Is FINALLY Here
Переглядів 105 тис.21 день тому
React 19 Is FINALLY Here
Why Doesn’t Everyone Use This Animation???
Переглядів 87 тис.21 день тому
Why Doesn’t Everyone Use This Animation???
The $4 BILLION Hack That Everyone Missed
Переглядів 64 тис.21 день тому
The $4 BILLION Hack That Everyone Missed
The New JS Features Coming Soon (I'm so hyped)
Переглядів 79 тис.21 день тому
The New JS Features Coming Soon (I'm so hyped)
I Failed An AI Job Interview (I can't believe this is real...)
Переглядів 61 тис.21 день тому
I Failed An AI Job Interview (I can't believe this is real...)
Vercel Gave Up On Edge
Переглядів 95 тис.28 днів тому
Vercel Gave Up On Edge
Why WebAssembly Can't Win
Переглядів 95 тис.Місяць тому
Why WebAssembly Can't Win
We need to talk about this benchmark
Переглядів 63 тис.Місяць тому
We need to talk about this benchmark
The Biggest Lie In HTML
Переглядів 88 тис.Місяць тому
The Biggest Lie In HTML

КОМЕНТАРІ

  • @kai12626
    @kai12626 2 години тому

    well, waiting for the immutable data structures proposal, records & tuples. stage 2...

  • @StephanHaewss
    @StephanHaewss 2 години тому

    You are absolutely right, I don’t understand why someone would say otherwise.

  • @victorvillacis6764
    @victorvillacis6764 2 години тому

    I still use vars and closures.

  • @figloalds
    @figloalds 2 години тому

    I use some sort of runtime generated Universal identification string, its 32 bytes consisting of: 8 bytes is a timestamp of when the program started, 8 bytes is the timestamp when the ID is generated, 8 bytes for a machine identification, 4 bytes for an incremental in-ram number that is randomly initialized, 4 bytes of random number. The timestamp values are in .Net "Ticks"; The result 32 bytes are converted to Base36 and that's my Runtime Id, I have never had collision in any of the stress tests that I could make.

  • @insu_na
    @insu_na 2 години тому

    In C++ you can absolutely change both the memory that a pointer points to, as well as the address of the pointer. There's a whole can of worms about `const int* someName` vs `int* const someName` vs `const int* const someName` vs `int const* someName` which is pretty annoying to deal with. The older I get, the more I appreciate a really good implementation of const-ness, and in C++ we're closing in on that with constexpr and consteval

  • @madangryscientis
    @madangryscientis 2 години тому

    I'm definitely on team const, but my linter auto fixing this can be annoying when you still writing the code.

  • @thephoenix215-po2it
    @thephoenix215-po2it 2 години тому

    Theo you want to start the flame war over this?

  • @CanKorkmazim
    @CanKorkmazim 2 години тому

    title: `const` was a mistake duration: 31 minutes you are perfect

  • @benmeehan1968
    @benmeehan1968 2 години тому

    Ryan's talk was clearly intended to be humorous, especially invoking ChatGPT as an authority (given that the output was clearly edited). Not distinguishing between integrals and ref's makes it an in joke for people sufficiently knowledgable about the language. Using screaming case is a hold over from when editors lacked tooltip context to understand whether, in a language like C, the symbol was a macro or a variable. Screaming case is rarely useful beyond TOUCH_THIS_AND_DIE or UNTIL_HELL_FREEZES_OVER semantics.

  • @planetchubby
    @planetchubby 2 години тому

    Ryan is a person who tries to be funny in public but fails because he is not funny but annoying.

  • @jonathandawson3091
    @jonathandawson3091 2 години тому

    18:00 was really peak of programmer's comedy 😅

  • @davidsiewert8649
    @davidsiewert8649 2 години тому

    I agree with Theo and disagree with Ryan

  • @svuvich
    @svuvich 2 години тому

    Damn, your explanation with a pointer and double-pointer at 15:24 was spot on, it finally clicked with me. Before this, this whole discussion seemed like a purely cultural/philosophical debate about religion and metaphysics. It still does to me, but now I feel like I actually know what the underlying thing is

  • @edd9581
    @edd9581 2 години тому

    Looks like half of JavaScript was a mistake at this moment

  • @dupdrop
    @dupdrop 2 години тому

    I can't believe what bullshit these js peasants argue about while there are actual problems in the world that need solving... like west-const vs-east const... ;)

  • @vaaaaaas
    @vaaaaaas 2 години тому

    Worst take 2024.

  • @andythedishwasher1117
    @andythedishwasher1117 2 години тому

    lmao "const=*, let=**" completely just explained this entire debate to me and I've been confused about it for several years. Holy crap I feel bad for all of us that learned JS as a first language. I gotta learn some C ...

  • @discontinuity7526
    @discontinuity7526 2 години тому

    const int * const ptr;

  • @Tom11Technik
    @Tom11Technik 2 години тому

    I get what are you saying, but I really like Dart implementation For different variable purpouse they have different modifier: 1. const -> real Constant (It forces you to have const threw the whole tree) 2. final -> js const - not changable, but inside modifiable 3. var -> js let (it does not have js var) But as it is said in DreamBread to be able to change it, but to have like array constant you woud do it like: var arr = const ['A', 'B', 'C'];

  • @mprync
    @mprync 2 години тому

    100% agree. I come from C++ and moved to frontend development and I will always default to const if I have no INTENTION to change what it points to. I use let rarely and that becomes even more rare the more we move towards fluent array transformations.

  • @TM_LBenson
    @TM_LBenson 2 години тому

    Great video. Id be interested to hear your thoughts on git commit messages: past tense vs present tense.

  • @blenderpanzi
    @blenderpanzi 2 години тому

    Don't let the perfect be the enemy of the good! So const is maybe misnamed? So what? It's still useful for the reasons Theo said.

  • @blenderpanzi
    @blenderpanzi 2 години тому

    The pronunciation argument is just a skill issue of English speakers. :P

  • @andythedishwasher1117
    @andythedishwasher1117 2 години тому

    As far as I understand it, you're correct that const isn't true immutability, but rather just acts as a guard rail around a piece of memory (in the heap) telling the interpreter "no, bad interpreter" whenever you try to mutate it after assignment. In effect, that often tends to translate into "no, bad junior developer. Fix that before you deploy." In the lawless realm of common JS pre-TypeScript, such guard rails seem like they would have been a welcome anchor in the maelstrom, but I wasn't there for that. I just started learning JS like 3 years ago, and I've found const useful just in solo programming to make sure I didn't do anything stupid after I figured something important out.

    • @andythedishwasher1117
      @andythedishwasher1117 2 години тому

      However, as you pointed out, if that const is an array, the junior devs are still free to get smelly with it....

  • @TodePond
    @TodePond 2 години тому

    wtf DreamBerd is crazy. can't see that being useful for anything

  • @revenity7543
    @revenity7543 2 години тому

    Just imagine const objects, arrays and functions are pointers. It all makes sense if you think it that way.

  • @engholm0
    @engholm0 2 години тому

    Wouldn’t this solve the problem: ‘const’: For constants / freezed objects ‘let’: For immutable references ‘var’: For mutable references

  • @flufster777
    @flufster777 2 години тому

    One-liner for replacing the brands array: brands.splice(0, brands.length, "a", "b", "c", "d");

  • @dansanger5340
    @dansanger5340 2 години тому

    Why is this even an argument? You use const because it's the closest thing to immutable that Javascript offers. When Javascript offers immutable, then use that.

  • @bravesirrobin9576
    @bravesirrobin9576 3 години тому

    The fact it allows for mutations doesn't mean it's useless, it's still a very helpful tool when reading the code. It is dumb that it behaves that way but I'm guessing there's some weird esoteric JS-BS reason that's the case.

  • @zeocamo
    @zeocamo 3 години тому

    after learning the hard way, we got a rule on work, we can't use var or let and only const, why well, when you don't reassign variables you get code you read from top to bottom, without crazy things in loop where the code do one thing and then if something next time if some thing else then it do that. this is hard to understand and read, making that kind of code full of bugs, so now with only const no one make that kind of crazy code, and we half the amount of bugs, and we make more features and look less in the black hole of despair. in the start people think you can't do stuff without let, but you are wrong, you are just thinking of the wrong way to fix that problem, there is always a simple way with reduce or filter to make the loops only do one pass, you can then reduce the result again and again, so each pass will fix one of the problems you used let for.

  • @professormikeoxlong
    @professormikeoxlong 3 години тому

    I'd like to point out TypeScript's `enum`. I know it isn't ideal but to be honest I find myself using it quite often for one-level deep objects who values don't change... it does exactly what you'd think it will and it solves about 90% of the use cases when `const` isn't constant enough. Of course there still remains the case of arrays, but we could, at some point, even come up with a 4th declaration statement... not ideal but personally I very much prefer explicit over implicit.

  • @MuhammadAhmad-ke5cl
    @MuhammadAhmad-ke5cl 3 години тому

    yea. i'll use var.

  • @Imjoshnewton
    @Imjoshnewton 3 години тому

    Lol I still like to use Var sometimes so that I can use a block scoped variable when needed.

  • @figloalds
    @figloalds 3 години тому

    it's a multiparadigm language and the keyword is CONST not IMUT, it was never supposed to behave like IMUT, I don't know where these guys get the idea that const has to be imutable. Const means that the reference is constant. I agree with you here, LET and CONST have more communication value to us if we use const to indicate that a value is not being reassigned.

  • @crashmstr
    @crashmstr 3 години тому

    Sorry, but in his presentation, did he say “I won’t tell you what to do” before telling us what to do? Thanks, Theo. I’m fully in the `const` camp, and not because of AirBnb.

  • @joshix833
    @joshix833 3 години тому

    const should've been named final

  • @snatvb
    @snatvb 3 години тому

    Theo, thanks that you give same thoughts that I have)

  • @ApprendreSansNecessite
    @ApprendreSansNecessite 3 години тому

    What I think many people are missing in the imperative world is that FP programmers don't need to freeze objects or protect themselves from mutations. We simply don't do it. If we do it, it's in a tiny and controlled scope. The mental load is just so much lower when you do that. When a FP programmer looks for an immutable data structure, it is not to prevent mutations. They don't do mutations, it is to have an efficient data structure, with structural sharing for example

  • @Sammysapphira
    @Sammysapphira 3 години тому

    This is why most online videogame like world of warcraft have maintenance and resets and big releases on tuesdays. Recently lots of online games have been releasing on friday night because of marketing wanting the biggest possible playcount. This compounds into higher traffic than expected, AND all the devs are on weekend.

  • @jsonkody
    @jsonkody 3 години тому

    The amount of ignorance right at the start of the talk 🫣🙄 .. ok good bye internets

  • @CottidaeSEA
    @CottidaeSEA 3 години тому

    People who complain about const "not working" with objects just don't know what const actually does. Const prevents you from reassigning a pointer. That's all it does.

  • @professormikeoxlong
    @professormikeoxlong 3 години тому

    Yes we don't really make anything immutable (except in rare cases). But there's a reason for that. And it's the same reason why libraries doing anything at all implicitly is very much frowned upon (adding custom methods to prototypes for example). Const is not for JavaScript to prevent the value from changing, but to prevent you from changing it.

  • @Skuiggly
    @Skuiggly 3 години тому

    js devs got so few real problems that they keep creating their own

  • @logusgraphics
    @logusgraphics 3 години тому

    Did you just write "return void" and then "void" just to see if that would satsify "void" return type? Why am I subscribed here?

  • @johansmith2840
    @johansmith2840 3 години тому

    functions are the only "Object" that is constant, as the signature does not change ever

  • @tjblackman08
    @tjblackman08 3 години тому

    Strongly agree.

  • @professormikeoxlong
    @professormikeoxlong 3 години тому

    I side with Theo on this one...

  • @julian7
    @julian7 3 години тому

    The more times I'm watching the Let Me Be talk, the more I think it's more like a satire.

  • @CreativeCloseup
    @CreativeCloseup 3 години тому

    Here's my take as a total beginner who is struggling to learn javascript at a senior age. Never knew when or where to use const vs. let. I don't know anything about mutation or that stuff. But what summarizes the whole video for me was your remark "const* and let**". I don't know anything about C++ and memory pointers either. But I find it easier to learn and "think" programming when concepts are explained in a very basic and primitive way. Everything starts to build up from there. Regardless that's it would be easier for me to use "let" almost everywhere, from now on I really understand the difference between both and I can think of both in a very solid way. Of course, as I mentioned before, this is the view of a newbie. Thanks for this video!