Next Generation TypeScript | Prime Reacts

  Рет қаралды 95,322

ThePrimeTime

ThePrimeTime

11 ай бұрын

Recorded live on twitch, GET IN
/ theprimeagen
Link to reviewed video: • Effect: Next-Generatio...
Channel: Ethan Niser - / @ethanniser
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact

Пікірлер: 459
@Kopraaaa
@Kopraaaa 11 ай бұрын
"Vanila" typescript got me
@TayambaMwanza
@TayambaMwanza 11 ай бұрын
Everyday mankind strays further and further...
@laloqf
@laloqf 11 ай бұрын
"Vanila" Effect next
@tonyvelasquez6776
@tonyvelasquez6776 11 ай бұрын
@TayambaMwanza my brother just confessed to me that he used to shoot ropes to photos of latrell spreewell
@tonyvelasquez6776
@tonyvelasquez6776 11 ай бұрын
@@laloqf i said son get on your knees!
@TheMr82k
@TheMr82k 11 ай бұрын
true even I was scared if we have reached that point
@calder-ty
@calder-ty 11 ай бұрын
There are libraries, there are frameworks and then there are language rewrites inside the language. I say: use libraries, be wary of frameworks, run from nested language rewrites.
@DubiousNachos
@DubiousNachos 11 ай бұрын
Looking at you Ramda
@calder-ty
@calder-ty 11 ай бұрын
@@DubiousNachos the name alone sounds like it is a functional language designed to take all your memory
@anonymousalexander6005
@anonymousalexander6005 11 ай бұрын
@@calder-tyfunctional only really works well with compilers, with the ability to aggressively optimize memory usage, e.g. overwriting a buffer instead of allocating a new buffer. It’s hard to get right in interpreted languages that weren’t built with functional programming in mind, *cough Python *cough, but with a JIT that’s optimized for it you can probably get 70% of the way there anyways.
@speltincorrectyl1844
@speltincorrectyl1844 11 ай бұрын
@@anonymousalexander6005 Interpreted languages claim that they are imperative and functional because they have lambda functions and a few higher order functions. Where are the monads? The monoids, functors and applicatives? Also python's lambda syntax is very ugly.
@erickmoya1401
@erickmoya1401 11 ай бұрын
What would you say about svelte. Where do you put it?
@terradtc
@terradtc 11 ай бұрын
Frameworks like this tend to result in write-only code and become legacy once the next fad shows up. Not saying it's not good, just saying 999 out of 1000 of these fail and fade with time, the other 1 will be deprecated because at some point useful features get first class support in the browser/base lib
@TheMr82k
@TheMr82k 11 ай бұрын
these are something should be pick-up by the core teams at JS or Node and built a standard pattern across but we all know how incompetent JS is at standardising things
@thekwoka4707
@thekwoka4707 4 ай бұрын
Especially with just how ridiculously bespoke and boilerplatey this is.
@phoenix-tt
@phoenix-tt 4 ай бұрын
First-class support is the perfect outcome. This is the issue with Js/Ts in general. Devs want some problems solved, but language designers seem to make poor decisions, leading to a poor code, leading to devs solving problems in a poor way, leading to devs wanting to solve some language problems, and the cycle repeats.
@griof
@griof 11 ай бұрын
This architecture is very common in Haskell. There are a few effects libraries and talks about them, if you want a taste of it
@andrewpatterson3139
@andrewpatterson3139 11 ай бұрын
Haskell has the GHC which optimizes functional code, FP is not a first class citizen in javascript
@griof
@griof 11 ай бұрын
@@andrewpatterson3139 Sure, but javascript developers can see how effective effects are (no pun intended). Also, IIRC Scala has a lot of software written this way (but I don't know that much scala). Of course, you should consider other aspects aside from developer experience such as performance, integration with the ecosystem, etc...
@CottidaeSEA
@CottidaeSEA 11 ай бұрын
@@griof Scala performance is horrible, wouldn't really use it as an example. The syntax is pretty nice though.
@avi7278
@avi7278 11 ай бұрын
​@@andrewpatterson3139it's hilarious how the people who leave your types of comments assume that performance matters to more than 2% of typescript developers who would be interested in this. Most of them don't even require the type of optimization you're talking about. It's about dev experience. Does Effect help the average typescript dev write more robust code, faster is the question. If they wanted to learn Haskell, they would.
@speltincorrectyl1844
@speltincorrectyl1844 11 ай бұрын
Haskellers: Look what they have to do to mimic a fraction of our power!
@thebaconing
@thebaconing 11 ай бұрын
He made a mistake at Effect.Effect return Effect.flatmap(effect: effect)) : Effect
@makeshiftartist_420
@makeshiftartist_420 11 ай бұрын
I think if JavaScript and Typescript devs would start to embrace the idea of errors as values and start writing libraries and packages using this model, we could probably inspire change among the community
@monad_tcp
@monad_tcp 10 ай бұрын
not going to happen, it will be forever fragmented we should kill JS with fire.
@ilearncode7365
@ilearncode7365 10 ай бұрын
what does "error as value" mean? Arent errors objects that have values? Or do you mean returning the error inside the try?
@monad_tcp
@monad_tcp 10 ай бұрын
@@ilearncode7365 it means returning a composite data type with either the result or the error instead of using the try catch and unwinding the call stack. Structured error handling was a mistake.
@jeremiedubuis5058
@jeremiedubuis5058 10 ай бұрын
@@monad_tcp I'm not sure I really get this, what bothers people is that errors aren't being handled ? I feel like it would bother me more if they all were in a generic unhelpful way, I mean this is literally what catches do without having to write the generic handling at every level. Let's say you have a stack that is router -> controller -> service -> model, do I really want to check the output for each function in the stack ? Isn't it just easier to throw a custom 404 from the model if what you're looking for doesn't exist ? If you are calling that from the API the router will handle the 404 and return the error code to HTTP. If you are using the model from a script or something you could handle the 404 error and output it to stderr or something. I really don't see the added value of the extreme verbosity of specific error returns at each level.
@bencelaszlo666
@bencelaszlo666 10 ай бұрын
I mean there are a bunch of libraries for handling errors in this way and actually I even worked in a project which used one of these. It was mostly okayish for our own code, but caused some really frustrating debugging sessions when someone made a mistake wrapping some other dependency.
@fire17102
@fire17102 11 ай бұрын
I love Ethan, can't wait for him to see this and address the performance aspects :) I'd throw in some more syntax sugar for some of these, and hope to see them benchmarked against "vanilla typescript" haha
@felipevelasquez1641
@felipevelasquez1641 11 ай бұрын
Disney+ was made with effect systems in Scala (Cats/ZIO), so they can be fairly efficient resource-wise.
@krux02
@krux02 11 ай бұрын
Scala isn't resource efficient.
@thavrisco1632
@thavrisco1632 11 ай бұрын
@@krux02 If Scala isn't then what is???
@spl420
@spl420 11 ай бұрын
​@@thavrisco1632rust
@rideorhitchhike3347
@rideorhitchhike3347 11 ай бұрын
​@@spl420 *mem::forgets half your memory* Nothing personnel kid.
@tauiin
@tauiin 11 ай бұрын
Explains why D+ is so shit then :^P
@pesiok
@pesiok 11 ай бұрын
Writing in this style in Scala with Cats Effect. It's quite nice actually.
@liquidsnake6879
@liquidsnake6879 11 ай бұрын
"a typescript library" i'd instantly click away
@TonKcedua
@TonKcedua 11 ай бұрын
People layering 30 layers of abstraction just to escape JavaScript be like:
@jacquesfaba55
@jacquesfaba55 11 ай бұрын
“It’s transpilers all the way downnnnnnn”
@XDarkGreyX
@XDarkGreyX 11 ай бұрын
Layer on layer on layer on layer on layer on layer
@EricSampson
@EricSampson 11 ай бұрын
“one more layer bro, I promise it’ll be finally good after I add just one more layer, I promise”
@d.sherman8563
@d.sherman8563 11 ай бұрын
@@jacquesfaba55 That's literally every language ever made 😄
@robmorgan1214
@robmorgan1214 11 ай бұрын
Looks like someone finally turned Tom loose on TypeScript. Someone needs to build fundamental tools that assume asynchronous operations by default and byzantine or distributed problems where concurrency primitives are EFFICIENTLY WRITTEN (memory efficient) first-class citizens allowing you to set sync points that run when dependencies resolve or are available. Unfortunately, this does not do that. Ultimately something capable of doing things like this is probably an interpreter mixed with a scheduler pretending to be a language... Good video and meta video!
@meppieomg
@meppieomg 9 ай бұрын
I love all the neckbeard knownit alls making shut up when they haven’t read a single line of code. Prime really encourages the bloviator crowd
@harleyspeedthrust4013
@harleyspeedthrust4013 11 ай бұрын
yeah I guess you could do this. But tbh it's a lot simpler to just have tagged unions representing an Ok or an Error (pretty much a sum type, enum, or whatever you want to call it, but a "union" of structs in TS). then in the happy path you return an Ok with the data and with the discriminator set to "ok", and in the error path you return an Error with the discriminator set to "error". The type declaration looks like this: type Result = { status: "ok"; data: T} | {status: "error"; err: Err} and you check the discriminator (`status`) to determine what to do. this encodes errors in the type system and effectively solves the problem, you just have to remember to put a .catch on every promise and return errs from catch blocks
@thekwoka4707
@thekwoka4707 4 ай бұрын
Well, it's nicer if you also provide the methods like Rust Results have, so you can work with them without needed to check each and every one individually.
@jesselawrence336
@jesselawrence336 11 ай бұрын
I am doing my degree in computer science currently and I have to say that I have learned more about programming from you than I ever have from school. You not only teach stuff but also show us how to fend for ourselves. Im looking forward to being as good as you are.
@Notoriousjunior374
@Notoriousjunior374 11 ай бұрын
Your Degree will definitely come in handy though. Employers will generally filter out those who have Degrees > without Degrees. Enjoy.
@peculiar-coding-endeavours
@peculiar-coding-endeavours 11 ай бұрын
That degree is a nice ticket to the big merry-go-round. Don't depend on it though to actually become good at your craft. You're on the right path following people like Prime. Keep yourself informed, and learn software development by diving into projects, learn new languages and frameworks, and just keep buiding stuff. You'll quickstart your career for sure.
@CrashPreinsertion
@CrashPreinsertion 11 ай бұрын
Prime is like the daddy mentor I never had. I've always been shit at picking good places to work, so a good mentor never materialized.
@jordixboy
@jordixboy 11 ай бұрын
@@Notoriousjunior374 thats like 5% of jobs. As a self taught engineer, never had trouble, not even at faang companies. IMO getting a degree is only a good investment if you have 0 clue. I was already coding when I was 10. got my first real software engineering job at 18, now I have +10years in the industry, without counting my self taught path (another 10 yrs)
@lydianlights
@lydianlights 11 ай бұрын
@@jordixboy You may also consider that you have survivorship bias before giving life advice to students. Your path does not seem to be the most common, as not every person can get successfully hired at 18 and build their career from there. Not saying it's not _a_ path, but it's not the most common one.
@steigerwalddaniel
@steigerwalddaniel 8 ай бұрын
I was using fp-ts, and I loved it, and Effect is even better. People writing comments here are like horse riders criticizing cars or people using zip files instead of git. The Effect is a great tool. I would ask them how you handle errors in your apps or libs? Try catch? Oh noooo, poor boy/girl. How do you pass dependencies? Manually or globals? How do you know this function can fail? Reading the source code? Really? And how do you structure code? Mutable classes? OMG. ThePrimeagen just reacts; he explained nothing... it's just a show-a waste of time.
@mblackritter
@mblackritter Ай бұрын
True, true - perfect "upwrite"! #OhHellboyYeah! ✊🏻 😻 🥳🎉
@seanknowles9985
@seanknowles9985 11 ай бұрын
Vanilla typescript - Vanilla typescript - Vanilla typescript - bossing the windup today.
@paca3107
@paca3107 11 ай бұрын
I am waiting for libraries for this Typescript library...
@allalphazerobeta8643
@allalphazerobeta8643 11 ай бұрын
It's a good reminder for new programmers to do your best to induce randomness to scheduled client request and all back offs. This some how escapes people's thinking. If all the client programs request an update on the hour. You're essentially building your own DDOS client. Will you be able to handle 100k clients all asking for the same resource at 1 am? what about million? and if so much more computer power are you paying for to do what could be spread out over 1 min? 5 min? an hour? etc. Instead, you can quiclky generate a random or pseudo-random offset*. Now, on the back-off and retry, you need to the same thing. Why? because if the server fails it will likely fail on the clients at near the same time meaning they'll retry at near the same time. Also, it needs to be more aggressive in fall-off and failure then you'd think when start getting into "scale." *Try to use something unique like user_id plus time, mac address plus time if you have to set your seed value. In environments where all clients have the same hardware. You might set your random seed to time since boot. That will be same or at least cluster for the devices with the same hardware and software. And setting to the current time at startup can also cause problems if your hardware boots up on it's own after a power outage since all the hardware will boot up at the same time. Nothing like suddenly having 10k clients in sync.
@tensor5113
@tensor5113 11 ай бұрын
You're just gonna casually forget that messaging queues exist?
@allalphazerobeta8643
@allalphazerobeta8643 11 ай бұрын
@@tensor5113 Okay, you're holding a million messages in your queue. 1. You have to have the infrastructure to accept and queue them. 2. You have to process them before you time out. Remember thanks to NTP all your clients are in near perfect sync.
@kevinfredericks2335
@kevinfredericks2335 11 ай бұрын
and for a great deep dive on this look in to why ethernet replaced ring token
@tensor5113
@tensor5113 11 ай бұрын
@allalphazerobeta8643 you're thinking too much about the time. Understand why 100k clients need a message at 1pm, and now try to see if they need it at their time locally or your time. Also, you can fanout the message, or do caching. 100k clients for 1 message isn't a small task, but its not a difficult one either either, unless you're doing many writes
@tensor5113
@tensor5113 11 ай бұрын
@pcap8810 in this scenario the fill up is temporary, so you can just buffer the excess messages and the load will soon go back to normal
@mickmister
@mickmister Ай бұрын
14:40 This happened to us for a websocket reconnect backoff algorithm, except the connections were successful, but there was an error that happened *every time* for all clients after that request, so the "request success" was never successfully processed, but the backoff algorithm thought it succeeded. So the backoff not only "didn't work", but it also compounded onto itself due to the exception bubbling and incomplete processing. So after a bit of time, all clients were sending 10+ expensive requests every second. It was like the Loch Ness monster hiding in the code trying to figure out the exact cause of the chaos.
@GAoctavio
@GAoctavio 11 ай бұрын
I agree, unless there is language syntax support its unusable. Look up "Algebraic Effects for the Rest of Us", the author introduces made up syntax which makes it way more simple to read and understand
@Bliss467
@Bliss467 11 ай бұрын
I highly expect the type name arguments in functions like catchError to be safe. I’ve accomplished similar things in my library functions and it provides intellisense too
@vnshngpnt
@vnshngpnt 11 ай бұрын
It’s pretty well known (and powerful) writing style in FP, it’s expected that mainstream languages catch up only a few years later. Although there is an old but vibrant libs and community around it in JS (see Fantasy Land).
@dinckelman
@dinckelman 11 ай бұрын
We're reaching a point where the bicycle has already been reinvented because round wheels were deemed inefficient, except the new wheels are now dorito shaped, and somehow it's better. Maybe things like wasm really will be the future, because this really isn't it, chief
@cat-.-
@cat-.- 11 ай бұрын
Wasm with access to web api should have been the thing all along. I’m also sad that Js as a compile target is not more prevalent. Though it’s a shitty compile target at least you don’t get to touch it directly.
@pokefreak2112
@pokefreak2112 11 ай бұрын
Couldn't disagree more lol, I like the idea of wasm but it's evident that it just causes people to create docker-esque complex monstrosities. Js as compile target is a blue pill. you may not like js but it's the unfortunate reality we live with, unless the new lang is a strict superset of javascript's feature set you're literally preventing yourself from writing optimal web code
@dinckelman
@dinckelman 11 ай бұрын
@@pokefreak2112 we can just agree to disagree. The benefit to WASM, at least in this case, is that there's a strong variety of things you can write that'd ultimately compile into the same thing. JS will aways be JS no matter what library you slap on top. Sure, it has a dominating presence over the current standards, but it doesn't mean it's flawless, or that it'll stay forever. Nothing stays forever, and it will be phased out by something better eventually
@mattymerr701
@mattymerr701 8 ай бұрын
​@@pokefreak2112 you're issue with WASM isn't the issue, the problem with WASM is mostly that it is still not first class and you have to bloody write JS interrop anyway.
@phoenix-tt
@phoenix-tt 4 ай бұрын
​​@@cat-.- Kotlin has JS, Wasm, Native and JVM targets, which looks like a big win. However, its JS target is ridden with OOP nonsense. I really wish they pushed for a minimal runtime overhead.
@eero8879
@eero8879 11 ай бұрын
Or just pretend you are writing Go and always return [T, error] . Very simple and works.
@ybabts
@ybabts 11 ай бұрын
Or you can just return a union type and not allocate unnecessary memory.
@IvanKleshnin
@IvanKleshnin 11 ай бұрын
​@@ybabtsbut Go has no union types 😢
@ybabts
@ybabts 11 ай бұрын
@@IvanKleshnin yeah but Typescript does. We're talking about Error handling in Typescript.
@Sairysss1
@Sairysss1 10 ай бұрын
"library for fixing complexity of modern development"... by adding more complexity?
@sammavrs
@sammavrs 11 ай бұрын
New Dev Question: I started noticing that TRY CATCH issue a while ago so I’ve been dealing with it by giving each Action item its own function with its own TRY CATCH. Then using a Controller function that Await Calls each function. The Function would catch the Error and move it up. Wouldn’t that be the solution to all this? If theres one thing I’ve learned in my short time, it’s never that simple Lol
@qm3ster
@qm3ster 10 ай бұрын
All monads where `flat_map`/`and_then` takes an `FnOnce` are effects. (Also, few things are easier to reason about than RxJS. The only time I had an "if the types check out I can reasonably expect it's doing what I want" experience in something JS-based.)
@brunokotesky5965
@brunokotesky5965 11 ай бұрын
The word "Effect" itself is already very traumatizing
@FlanPoirot
@FlanPoirot 11 ай бұрын
how? it's just a side effect piped from one to the other, it stops running once one of the effects fails. what's traumatizing about it?
@brunokotesky5965
@brunokotesky5965 11 ай бұрын
@@FlanPoirot useEffect
@bansh3ee
@bansh3ee 11 ай бұрын
@@FlanPoirot if everything is a side effect, is there any intended effect?
@FlanPoirot
@FlanPoirot 11 ай бұрын
@@brunokotesky5965 well react is kind trash (imo), and useEffect is only very very distantly related to the effects being used here
@azerkahn
@azerkahn 11 ай бұрын
Just write a new language instead. If you want to fix language issues, don't do it inside the same language. Make a language that compiles down to wasm, and by the time you're getting it put together, wasm will have direct access to a bunch of useful browser APIs, and you won't even need to get messy with JS layers of the language.
@ryaaann
@ryaaann 10 ай бұрын
couldnt agree more. im sick of all this libraries/frameworks trying to fix javascripts problems and making the developer experience worse.
@sufyan56
@sufyan56 10 ай бұрын
Ah yes, spend probably 10x more time, reinvent so much stuff, and then eventually just have it die in obscurity.
@thingsiplay
@thingsiplay 11 ай бұрын
Is Effect a Library or a Framework? Do you become a Effect programmer?
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
yes
@sck3570
@sck3570 11 ай бұрын
No?
@Mitch_Crane
@Mitch_Crane 11 ай бұрын
When the hoodie comes off we get a buff overflow
@josefjelinek
@josefjelinek 11 ай бұрын
completely agree with the conclusion and drawing parallel with rxjs. More people should start thinking about that before they quit the project they started bacause they cannot debug anything anymore... Also profiling in the browser is a nightmare as everything is fragmented and scattered all over the graphs...
@danielvaughn4551
@danielvaughn4551 11 ай бұрын
The DBClient example reminds me of ObjectiveC protocols, though protocols are much clearer and explicit.
@avi7278
@avi7278 11 ай бұрын
OK I just watched the video. I'm very excited about my next typescript project: Effect Effect Effect Effect Effect Effect Erect Effect Effect
@Wolfeur
@Wolfeur 11 ай бұрын
Sometimes I have trouble understanding some specific things that are discussed but it's ok since I'm not the most knowledgeable about more low-level and memory concepts. I am however fairly experienced in JS and TS, so when I see these videos and don't understand half of what's being said, my impostor syndrome level goes through the roof.
@XDarkGreyX
@XDarkGreyX 10 ай бұрын
I started out with JS, jQ and PHP due to WP. While I took notice of all the other languages and tech, only when I found Fireship the syndrom actually swept me away. I have been getting more and more into contact with the rest of the world since, and it's been quite the journey....
@thekwoka4707
@thekwoka4707 4 ай бұрын
Well, the presented code there was shit...
@mikidep_old
@mikidep_old 11 ай бұрын
Yes please give us a programming language with effects! If you want to see the theory look up "algebraic effects and handlers", it's s concept that's been studied for some decades now. Algebraic effects capture a class of effectful computations that can be reasoned about, well, algebraically. Monads can implement all algebraic effects, but their logic sometimes is too abstract and fails to capture some properties of specific effect systems.
@cheaterman49
@cheaterman49 10 ай бұрын
Yeah, this might just be trying to do too much ; the error handling is OK-ish although as you mentioned it could really benefit from language level support (prettier syntax), but the concurrency thing sounds like it belongs in a completely separate language. It could work the other way around too, perhaps ; it could be an alternative async library, the way we have some in Python, while trying to instead make the error handling part of the language?
@theultimateevil3430
@theultimateevil3430 11 ай бұрын
I kind of hate opinionated frameworks with passion, thanks Qt. When someone tries to modify the workflow of a language - adds language extensions/preprocessors (Qt, React), forces a code structure (often with a custom build system that stops working after a while, hey Meteor), adds programming primitives that are incompatible with the baseline of the language (Effect is a great example of this) - the project becomes unmaintainable trash in a 2-3 years. Frameworks like React - that are, arguably, a net positive between a forced structure+primitives vs simplicity+standardization - are exceedingly rare.
@meppieomg
@meppieomg 9 ай бұрын
You have no clue what you’re talking about. You havent read a single line of the source. This dudes channel attracts so many blow hard
11 ай бұрын
If TS is JS with types then what is TS with `Any` types and try/catch blocks? Hey Tom do you know?
@chineduabalogu
@chineduabalogu 11 ай бұрын
type and variable with the same name belong to different namespace and the compiler does its work.. has no limitations except naming conventions working with multiple devs
@yueyu9762
@yueyu9762 11 ай бұрын
Been waiting for your reaction to this. Thanks man ❤
@bitcoindaddy748
@bitcoindaddy748 10 ай бұрын
my boy ZIO is getting into JavaScript ecosystem lol
@andrueanderson8637
@andrueanderson8637 10 ай бұрын
Literally just ZIO for TS
@n30v4
@n30v4 5 ай бұрын
I just use const [value, error] = function, and force to return [value, error] on my functions. For 3rd Party I use "etov" as wrapper. Thats fine for me and its working. It works with async and sync.
@nightshade427
@nightshade427 11 ай бұрын
The depency injection part looks like ServiceLocator pattern
@mfsbo
@mfsbo Ай бұрын
Agree with “typing strings is always a worry and should use something else”
@mjerez6029
@mjerez6029 11 ай бұрын
Next generation typescript ia having types at runtipe. Feepkit is doing a great work on this. Please have a look into it 🙏
@nathanbourquin6554
@nathanbourquin6554 11 ай бұрын
Gosh the more I watch these videos the more I love Go
@Kats0unam1
@Kats0unam1 10 ай бұрын
On the frontend I like the react-query way of handling errors and fetching data. On the backend use Elysia or use another language other than JS if possible.
@aslilac
@aslilac 11 ай бұрын
the generator function thing is a pretty neat idea, but I agree that it just doesn't really seem like it fits into the language, and would be prone to spreading to places where it only complicates the problem for no real reason.
@lowsca
@lowsca 11 ай бұрын
Effect triggered my Coffeescript PTSD
@minikame2272
@minikame2272 11 ай бұрын
Error, Value instead of Value, Error saves you the hassle of explicitely returning undefined
@vitiok78
@vitiok78 11 ай бұрын
And people say Go has bad error handling. if err is 1000 times better than try - catch
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
agreed
@jessejayphotography
@jessejayphotography 11 ай бұрын
..and then Go inexplicably skipped past pattern matching because they are masochists.
@AG-ur1lj
@AG-ur1lj 11 ай бұрын
Prime says he is pushing 40, but his torso can’t be more than a day past 25.
@novarem9828
@novarem9828 11 ай бұрын
Sus 🤨📸
@shubhambhattacharjee1111
@shubhambhattacharjee1111 4 ай бұрын
Fun fact an object having a then method can be used like a promise in js.
@Fanaro
@Fanaro 10 ай бұрын
If they had debugging functionalities as well, would that fix your issues?
@mikidep_old
@mikidep_old 11 ай бұрын
Microsoft is doing some research on effect types as well, look up Koka
@MaxHaydenChiz
@MaxHaydenChiz 11 ай бұрын
Question for Prime and the web devs here: what's wrong with non-typescript languages that compile to readable Javascript? (I'm thinking Purescript or ReScript, but there are probably others.) I can understand why you wouldn't want something that emits something you can't read and I understand that using web assembly has costs and overhead. But is there some reason beyond popularity / familiarity to use Typescript over Purescript et al.?
@aldeywahyuputra5719
@aldeywahyuputra5719 10 ай бұрын
It's not (only just) about familiarity, but also it builds on what you already know instead of having to "reinvent the wheel": Because syntax-wise, ALL JavaScript codes IS automatically Typescript code. Why bother with languages that have different syntaxes altogether if you're only going to compile them into OTHER language with a totally different syntax too just for the "extra" features, when there's this language (TS) that can accomplish them WHILE letting you keep those familiarity? Seems like a waste of resource to the point that just use a language like Rust or Go that have their own unique benefits.
@zeocamo
@zeocamo 11 ай бұрын
in node error is first as there is only 1 error, but more paramers
@Bliss467
@Bliss467 11 ай бұрын
Memory concerns with JavaScript 🤔 Okay, yeah that makes sense. I haven’t encountered those issues yet but I get it. But are you really programming with JavaScript for televisions? Wouldn’t you do it in C or Java? Are televisions closer to imbedded systems, browsers, or operating systems?
@theairaccumulator7144
@theairaccumulator7144 11 ай бұрын
most smart tvs are just running android so you're just doing mobile dev
@user-fr2fm3ri3w
@user-fr2fm3ri3w 11 ай бұрын
Java tv wtf man where did you buy that tv from hell 🥶
@bigmistqke
@bigmistqke 10 ай бұрын
​@@user-fr2fm3ri3wandroid
@theshermantanker7043
@theshermantanker7043 4 ай бұрын
​@@user-fr2fm3ri3wstill better than your shitty JavaScript
@harshgandhi100
@harshgandhi100 10 ай бұрын
Prime without hoodie is something I never thought I will see in my life.
@KangoV
@KangoV 3 ай бұрын
Modern Java now espouses return types modelled by an interface with multiple records (structs) implementing it. You then use switch with pattern matching on the result. You create an exception and wrap it in the result (the Error record type), but not throw it. So much better developer experience. Is this better?
@timothyvandyke9511
@timothyvandyke9511 10 ай бұрын
Alternate title: Prime tries so hard to like software he hates and not be a bully for 24 minutes and 44 seconds. (He succeeds)
@ThePrimeTimeagen
@ThePrimeTimeagen 10 ай бұрын
hah, I WAS KIND OK
@theshermantanker7043
@theshermantanker7043 4 ай бұрын
Prime try not to be an asshole challenge (IMPOSSIBLE)
@ybabts
@ybabts 11 ай бұрын
I wrote something like this, but only the error handling. Just capture the errors as values and use type guarding to "handle" the errors.
@Thect
@Thect 11 ай бұрын
Prime hiding all the muscles under that hoodie Is that hoodie some kind of power limiter or
@Lemmy4555
@Lemmy4555 11 ай бұрын
Are we going from wrapping every html tag in a react component to wrap every js line in an "Effect" call? 🤨
@vitiok78
@vitiok78 11 ай бұрын
"Library", "next generation" ... These are the spam words for me nowadays. Let's fix the fix with the fix that fixed that previous fix
@shankarsengupta1948
@shankarsengupta1948 11 ай бұрын
Functional programming has arrived for typescript.
@kelvinsanyaolu995
@kelvinsanyaolu995 10 ай бұрын
Are we bringing back "OrDie" like PHP ? That Effect syntax needs to be cleaned up or we might as well go back to callback hell
@Asto508
@Asto508 11 ай бұрын
I honestly had to vomit on the first Effect code and it didn't stop afterwards either. Glad I'm not a Web developer that has to deal with sh*t like that.
@olzk4705
@olzk4705 10 ай бұрын
12:12 why? How does it help? Too much code based on (was it ever proven?) assumption that it’s unrealistic to make dependency injection at 11:15? I’d really like to see the code for which they implemented this wrapper.
@thekwoka4707
@thekwoka4707 4 ай бұрын
"Effect provides a better way" and then vomits all over the code.
@riptorforever2
@riptorforever2 11 ай бұрын
Who is this guy talking? He looks like the prime-guy, but we all know that the prime-guy has the hood as an essential part of his brain. It's like a turtle and his shell, they could not be apart.
@cw6913
@cw6913 11 ай бұрын
Where the hell is the black hoodie, prime?
@JohnBuildWebsites
@JohnBuildWebsites 10 ай бұрын
As a web dev that exclusively uses typescript in React apps, I have no idea what current 'real world' issues this would solve for me. What am I missing? Also really confused every time I hear him say "useEffect", but then try and go back and remember he is probably saying "use Effect"
@mattymerr701
@mattymerr701 8 ай бұрын
As the video shows, it is to make error handling more concrete and able to be reasoned about. Instead of just throwing code around and pretending like errors don't exist because they aren't documented properly, it is about making them more obvious and making the handling of them easier.
@mattymerr701
@mattymerr701 8 ай бұрын
Whether or not it achieves that is another thing
@JohnBuildWebsites
@JohnBuildWebsites 8 ай бұрын
@@mattymerr701 had to go back and rewatch as it had been 2 months, but my question still stands. This looks like a needless abstraction over existing error handling strategies we already use in web dev world. I can see it might help those coming from a place that is more familiar with these patterns, but I just see a nightmare of training sessions for jr web devs (if not mids, sr, too).
@pertsevds
@pertsevds 11 ай бұрын
"My mind personally is racing with memory". Like a race condition? =)
@ryanleemartin7758
@ryanleemartin7758 11 ай бұрын
haskel is so glorious, you can only write whitepapers. gottem!
@fenkraken
@fenkraken 11 ай бұрын
My man pretends there was no Effect libraries before him? There’s entire FantasyLand spec, brother.
@IvanKleshnin
@IvanKleshnin 11 ай бұрын
Yes, exactly I can name at least 6 major previous attempts. FP-TS is the latest. This guy has no moral right to hush them up.
@SeanJMay
@SeanJMay 11 ай бұрын
This isn't for people who know enough FP to write their own endofunctors and monads. Nor for people who know enough about TypeScript to write generic monads with bimap implementations, like Either, which allow the type of Left to change at every turn, while maintaining perfect type correctness, through the chain. Give it a try in TS3 or TS4. It is an absolute nightmare. This is lazy-execution monads, without using the word "monad", for people who don't know what a monad is, with an async generator coroutine runtime.
@fenkraken
@fenkraken 11 ай бұрын
@@SeanJMay unfortunately for myself I tried way too hard to make FP work in JS, so I tried many things throughout the years. There was an abundance of libraries that were JS first and had no type inference, so if this one is actually good at that this is QoL improvement. The only libraries that were not absolute nightmare was purify-ts, and fp-ts. First one didn’t have many niceties of his library, and was more about the most popular ADTs so little bit unfair. Syntactically it was much better than Effect, imo. Second one can do almost anything, but it’s definitely inaccessible for public use, because to even read the docs you have to know a LOT of FP theory. I never had a chance to use it on “real” project because nobody around me would be able to read it. So I can concede that if he addressed all of these points, it’s an achievement. I just don’t know why you would throw prior art under the bus? Especially since some of his promise wrappers is basically 1 to 1 syntactically to bluebird, but with extra features under the hood. The fact that he build fibers runtime for all of that is impressive, sure. And the main reason I stopped doing all of that and kinda skeptical about all of it - it’s still going to be horrible at runtime, compared to writing it “normal way”. Most of the UI frameworks will not be playing nicely with this paradigm either in code or in runtime. So your only real choice of using it is creating your own frontend framework with these primitives in mind or doing so on the backend, which I will never do on my own volition. I know there are like 10 people in the world who write JS/TS that actually care about performance a little, but if I have to write it I can actually bring myself to normalize error handling in the app and just wrap the top function in the tryCatch.
@bricecarpentier5817
@bricecarpentier5817 10 ай бұрын
Well, gcanti (the guy behind fp-ts) is one of the main contributors of effect, so there’s that… You can basically use effect as a more accessible fp-ts, without having to opt in all of their runtime system.
@timothyvandyke9511
@timothyvandyke9511 10 ай бұрын
"right off the rip" 👀
@GoblinDigital
@GoblinDigital 11 ай бұрын
If this is a clickbait title god damn it. Edit: Nvm it looks pretty promising
@jkennethking
@jkennethking 11 ай бұрын
"all languages are flawed, so.." is such a low bar to clear
@badunius_code
@badunius_code 10 ай бұрын
3:50 in which way is this better than just a promise chain?
@pavloburyanov5842
@pavloburyanov5842 2 ай бұрын
Devs at 90' - we need to create lookup table of sin/cos. Devs today map map pipe recurse
@SJHunter86
@SJHunter86 9 ай бұрын
When are we getting Primeagen courses
@erickmoya1401
@erickmoya1401 11 ай бұрын
I like it as an experiment. But I am really tired of the years we have on trying to "improve" javascript adding a whole layer of concrete on top. Not really solving it, just covering the ugly.
@sub-harmonik
@sub-harmonik 11 ай бұрын
if you want to swap out your db for testing, wouldn't you have some kind of service that fetches a particular resource? Why wouldn't you just change it there?
@SeanJMay
@SeanJMay 11 ай бұрын
The service is written in TypeScript.
@RemotHuman
@RemotHuman 10 ай бұрын
I wonder if you could instead make a language that is compatible with typescript but has extra syntax so all these new language features are not quite as messy. Svelte does this sort of
@AngelHdzMultimedia
@AngelHdzMultimedia 10 ай бұрын
Civet?
@krtirtho
@krtirtho 11 ай бұрын
I know a simple solution to error bubbling caused by try/catch syntax *Just think everything can result an exception*
@br3nto
@br3nto 11 ай бұрын
I don’t understand the problem with promises already running in the background and the value being memoized. Just pass around a function instead. You can then call the function as many times as you like and get new values each time.
@arunas554
@arunas554 11 ай бұрын
Please upload a clip with silver celebration & hard working thought 🙃 at the end. It is a great representation of a time we live in.
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
i could get that done :)
@marble_wraith
@marble_wraith 11 ай бұрын
jezus TS got vanilla'd?
@br3nto
@br3nto 11 ай бұрын
11:31 that looks like nightmare code 🫣🙈
@anon-fz2bo
@anon-fz2bo 11 ай бұрын
this vid caused to me finally learn how to implement callbacks in c++ jbc reading the snippits confused me at first. now i get that effect is more like a struct with static methods that take in generic funcs that return self.. dunno why the syntax for defining it in typescript is an arrow function tho.. what an abomination.
@alexandrucomanescu9857
@alexandrucomanescu9857 11 ай бұрын
Can’t this be implemented using webstreams with transforms?
@redbenus
@redbenus 10 ай бұрын
How is this any different from what things like rxjs offer?
@TheMr82k
@TheMr82k 11 ай бұрын
we should all just move to Dart it has all the benefits of JS with easy to get started and non blocking io with event loop without the pain of JS.
@johnyewtube2286
@johnyewtube2286 11 ай бұрын
He finally took off his trademark hoodie. Imagine the smell.
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
mostly smelled of smugness
@AaronMartinColby
@AaronMartinColby 11 ай бұрын
As I watch this, all I can think is that they seem to want a new language. ReasonML tried that. It makes sense though; disconnect the implementation from the syntax.
@Lambdaphile
@Lambdaphile Ай бұрын
2:36 - LOL
@AwesomeAsh99
@AwesomeAsh99 10 ай бұрын
Bro is looking beefy
@NphiniT
@NphiniT 11 ай бұрын
What does he mean by "V8 is not single threaded?" It's not??
Prime React: The Story of TypeScript
15:02
ThePrimeTime
Рет қаралды 60 М.
Ditch Your Favorite Programming Paradigm | Prime Reacts
16:02
ThePrimeTime
Рет қаралды 115 М.
ГДЕ ЖЕ ЭЛИ???🐾🐾🐾
00:35
Chapitosiki
Рет қаралды 9 МЛН
ТАМАЕВ vs ВЕНГАЛБИ. Самая Быстрая BMW M5 vs CLS 63
1:15:39
Асхаб Тамаев
Рет қаралды 3,9 МЛН
DELETE TOXICITY = 5 LEGENDARY STARR DROPS!
02:20
Brawl Stars
Рет қаралды 16 МЛН
Climbing to 18M Subscribers 🎉
00:32
Matt Larose
Рет қаралды 23 МЛН
Migration Lesson: Don't Use Prisma | Prime Reacts
29:16
ThePrimeTime
Рет қаралды 144 М.
Why I Like Programming in C.
3:16
Francisco Jinto Fox
Рет қаралды 23 М.
How GO Was Created - Less Is More | Prime Reacts
28:15
ThePrimeTime
Рет қаралды 128 М.
Why Svelte is BETTER Than React | Prime Reacts
11:28
ThePrimeTime
Рет қаралды 164 М.
Why Effect is more important than ZIO by John A. De Goes (Effect Days 2024)
33:42
Effect | TypeScript at Scale
Рет қаралды 8 М.
TS vs JSDoc | Prime Reacts
22:11
ThePrimeTime
Рет қаралды 88 М.
The Best Golang Book | Prime Reacts
16:00
ThePrimeTime
Рет қаралды 104 М.
Creator of Go on Software Complexity | Rob Pike | Prime Reacts
42:45
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 384 М.
iPhone 15 Pro vs Samsung s24🤣 #shorts
0:10
Tech Tonics
Рет қаралды 13 МЛН
Mem VPN - в Apple Store
0:30
AndroHack
Рет қаралды 99 М.
Жёсткий тест чехла Spigen Classic C1
0:56
Romancev768
Рет қаралды 699 М.