Next Generation TypeScript | Prime Reacts

  Рет қаралды 105,068

ThePrimeTime

ThePrimeTime

Күн бұрын

Пікірлер: 483
@Kopraaaa
@Kopraaaa Жыл бұрын
"Vanila" typescript got me
@TayambaMwanza
@TayambaMwanza Жыл бұрын
Everyday mankind strays further and further...
@laloqf
@laloqf Жыл бұрын
"Vanila" Effect next
@tonyvelasquez6776
@tonyvelasquez6776 Жыл бұрын
@TayambaMwanza my brother just confessed to me that he used to shoot ropes to photos of latrell spreewell
@tonyvelasquez6776
@tonyvelasquez6776 Жыл бұрын
@@laloqf i said son get on your knees!
@TheMr82k
@TheMr82k Жыл бұрын
true even I was scared if we have reached that point
@calder-ty
@calder-ty Жыл бұрын
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 Жыл бұрын
Looking at you Ramda
@calder-ty
@calder-ty Жыл бұрын
@@DubiousNachos the name alone sounds like it is a functional language designed to take all your memory
@anonymousalexander6005
@anonymousalexander6005 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
What would you say about svelte. Where do you put it?
@thebaconing
@thebaconing Жыл бұрын
He made a mistake at Effect.Effect return Effect.flatmap(effect: effect)) : Effect
@griof
@griof Жыл бұрын
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 Жыл бұрын
Haskell has the GHC which optimizes functional code, FP is not a first class citizen in javascript
@griof
@griof Жыл бұрын
@@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 Жыл бұрын
@@griof Scala performance is horrible, wouldn't really use it as an example. The syntax is pretty nice though.
@avi7278
@avi7278 Жыл бұрын
​@@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 Жыл бұрын
Haskellers: Look what they have to do to mimic a fraction of our power!
@steigerwalddaniel
@steigerwalddaniel Жыл бұрын
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 7 ай бұрын
True, true - perfect "upwrite"! #OhHellboyYeah! ✊🏻 😻 🥳🎉
@IvanKleshnin
@IvanKleshnin 3 ай бұрын
What was the number of code lines in your project with Effect-TS? Zod tends to ruin compiler performance way before 1M, even before 500K lines of code. And this stuff is a Zod++.
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
​@@IvanKleshninhow deep on the spectrum do you have to be to care about lines of code
@terradtc
@terradtc Жыл бұрын
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 Жыл бұрын
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 11 ай бұрын
Especially with just how ridiculously bespoke and boilerplatey this is.
@phoenix-tt
@phoenix-tt 11 ай бұрын
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.
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
​@@thekwoka4707it's not bespoke, it's basic computer science. These concepts aren't going anywhere. It's not some meme js framework. With that being said ya it's ugly in ts
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
It's not a framework at all, just a library that focuses around the IO monad in a convenient way. The library might go away, these concepts never will and the will always be something like this. Hopefully built into the language
@sudo_apt_install_youtube
@sudo_apt_install_youtube Жыл бұрын
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 Жыл бұрын
not going to happen, it will be forever fragmented we should kill JS with fire.
@ilearncode7365
@ilearncode7365 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
@@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 Жыл бұрын
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.
@pesiok
@pesiok Жыл бұрын
Writing in this style in Scala with Cats Effect. It's quite nice actually.
@felipevelasquez1641
@felipevelasquez1641 Жыл бұрын
Disney+ was made with effect systems in Scala (Cats/ZIO), so they can be fairly efficient resource-wise.
@krux02
@krux02 Жыл бұрын
Scala isn't resource efficient.
@thavrisco1632
@thavrisco1632 Жыл бұрын
@@krux02 If Scala isn't then what is???
@spl420
@spl420 Жыл бұрын
​@@thavrisco1632rust
@rideorhitchhike3347
@rideorhitchhike3347 Жыл бұрын
​@@spl420 *mem::forgets half your memory* Nothing personnel kid.
@tauiin
@tauiin Жыл бұрын
Explains why D+ is so shit then :^P
@GAoctavio
@GAoctavio Жыл бұрын
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
@mickmister
@mickmister 7 ай бұрын
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.
@seanknowles9985
@seanknowles9985 Жыл бұрын
Vanilla typescript - Vanilla typescript - Vanilla typescript - bossing the windup today.
@theultimateevil3430
@theultimateevil3430 Жыл бұрын
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 Жыл бұрын
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
@hannad
@hannad 2 ай бұрын
Haha. Love it.
@paca3107
@paca3107 Жыл бұрын
I am waiting for libraries for this Typescript library...
@fire17102
@fire17102 Жыл бұрын
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
@thingsiplay
@thingsiplay Жыл бұрын
Is Effect a Library or a Framework? Do you become a Effect programmer?
@ThePrimeTimeagen
@ThePrimeTimeagen Жыл бұрын
yes
@sck3570
@sck3570 Жыл бұрын
No?
@jesselawrence336
@jesselawrence336 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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.
@MagicAndReason
@MagicAndReason Жыл бұрын
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 Жыл бұрын
@@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)
@lunafoxfire
@lunafoxfire Жыл бұрын
@@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.
@robmorgan1214
@robmorgan1214 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 11 ай бұрын
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.
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
I like how typescript devs had to make up a bunch of random words to sound smart because learning the actual words from type theory and category theory was too scary
@harleyspeedthrust4013
@harleyspeedthrust4013 Ай бұрын
@@AndreiGeorgescu-j9p typescript devs didn't invent those words; they've been in use since unions were a part of C, and maybe even before then. and i hope you would give some examples of "the actual words" from type theory and category theory, that typescript devs are apparently too stupid to use. maybe the words you're thinking of don't map as cleanly onto typescript as you think they should.
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
@@harleyspeedthrust4013 ya well typescript is carrying on the tradition of C and every other imperative language of just building on top of adhoc nonsense. Instead of just learning computer science, they're at best learning the von neuman architecture system, at worst whatever adhoc nonsense some guy decided to make at any given time. John Backus used up his nobel prize speech in the 70s to criticize this and it's only gotten worse. Typescript doesn't have a real type system. It's not nominative like haskell or even Java, it's structure based which is why so many things are so verbose. It's the reason why a library like effect looks so bloated in JavaScript, because these are things that should just be in the language but hand to be tacked on. JavaScript was actually supposed to be a functional language but that got changed and it was a prototype of a language. Looking over what you said again you did actually mention sum types and tagged unions but discriminated unions aren't a thing and neither are discriminators. These are things typescript made up. What you're looking for here is to create a sum type to handle the different states your response can be in. That's really it. You'll often see Either be brought up to do this which is an abuse of the functor Speaking of functor, typescript people seem to have no idea it exists and use the map function like it's some kind of adhoc function for lists (sorry they call them arrays, you can't upset von neuman). Same for catamorphisms, applicative, alternatives, traversables, and even monads. I also notice typescript people talk about things like effect, which is really just a library based around the IO monad, like it's some fad style somebody came up last year and isn't just a wrapper around a fundamental concept in math. Most software "engineers" are just mechanics and sure think like them. And most importantly, it's a programming language's job to implement computer science/programming language theory concepts, not the other way around. If there is something in typescript that cannot be explained in category theory then it almost certainly shouldn't exist. Dependent types are the closest things to an important concept I can think of that isn't easy to figure out in category theory but that's like 5 type systems above the level of where typescript is at which is embarrassing in 2024.
@AndreiGeorgescu-j9p
@AndreiGeorgescu-j9p Ай бұрын
@@harleyspeedthrust4013 ya well typescript is carrying on the tradition of C and every other imperative language of just building on top of adhoc nonsense. Instead of just learning computer science, they're at best learning the von neuman architecture system, at worst whatever adhoc nonsense some guy decided to make at any given time. John Backus used up his nobel prize speech in the 70s to criticize this and it's only gotten worse. Typescript doesn't have a real type system. It's not nominative like haskell or even Java, it's structure based which is why so many things are so verbose. It's the reason why a library like effect looks so bloated in JavaScript, because these are things that should just be in the language but hand to be tacked on. JavaScript was actually supposed to be a functional language but that got changed and it was a prototype of a language. Looking over what you said again you did actually mention sum types and tagged unions but discriminated unions aren't a thing and neither are discriminators. These are things typescript made up. What you're looking for here is to create a sum type to handle the different states your response can be in. That's really it. You'll often see Either be brought up to do this which is an abuse of the functor Speaking of functor, typescript people seem to have no idea it exists and use the map function like it's some kind of adhoc function for lists (sorry they call them arrays, you can't upset von neuman). Same for catamorphisms, applicative, alternatives, traversables, and even monads. I also notice typescript people talk about things like effect, which is really just a library based around the IO monad, like it's some fad style somebody came up last year and isn't just a wrapper around a fundamental concept in math. Most software "engineers" are just mechanics and sure think like them. And most importantly, it's a programming language's job to implement computer science/programming language theory concepts, not the other way around. If there is something in typescript that cannot be explained in category theory then it almost certainly shouldn't exist. Dependent types are the closest things to an important concept I can think of that isn't easy to figure out in category theory but that's like 5 type systems above the level of where typescript is at which is embarrassing in 2024.
@sammavrs
@sammavrs Жыл бұрын
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
@allalphazerobeta8643
@allalphazerobeta8643 Жыл бұрын
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 Жыл бұрын
You're just gonna casually forget that messaging queues exist?
@allalphazerobeta8643
@allalphazerobeta8643 Жыл бұрын
@@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 Жыл бұрын
and for a great deep dive on this look in to why ethernet replaced ring token
@tensor5113
@tensor5113 Жыл бұрын
@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 Жыл бұрын
@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
@liquidsnake6879
@liquidsnake6879 Жыл бұрын
"a typescript library" i'd instantly click away
@TonKcedua
@TonKcedua Жыл бұрын
People layering 30 layers of abstraction just to escape JavaScript be like:
@jacquesfaba55
@jacquesfaba55 Жыл бұрын
“It’s transpilers all the way downnnnnnn”
@XDarkGreyX
@XDarkGreyX Жыл бұрын
Layer on layer on layer on layer on layer on layer
@EricSampson
@EricSampson Жыл бұрын
“one more layer bro, I promise it’ll be finally good after I add just one more layer, I promise”
@d.sherman8563
@d.sherman8563 Жыл бұрын
@@jacquesfaba55 That's literally every language ever made 😄
@Wolfeur
@Wolfeur Жыл бұрын
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 Жыл бұрын
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 11 ай бұрын
Well, the presented code there was shit...
@azerkahn
@azerkahn Жыл бұрын
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 Жыл бұрын
couldnt agree more. im sick of all this libraries/frameworks trying to fix javascripts problems and making the developer experience worse.
@sufyan56
@sufyan56 Жыл бұрын
Ah yes, spend probably 10x more time, reinvent so much stuff, and then eventually just have it die in obscurity.
@vnshngpnt
@vnshngpnt Жыл бұрын
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).
@Mitch_Crane
@Mitch_Crane Жыл бұрын
When the hoodie comes off we get a buff overflow
@Bliss467
@Bliss467 Жыл бұрын
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
@IvanKleshnin
@IvanKleshnin 3 ай бұрын
I remember Redux Saga was hot back in the days. Quite a lot of companies used it, or at least attempted to use... Now does anyone have the courage to admit that all that experiments were a mistake? And Saga's ambitions pale in comparison to this library. Effect-TS wants to rewrite everything: validation, Math.random, datetime helpers, fetch... everything. Will it succeed or fail miserably? Well, I'm not aware of ANY precedent of a language + full ecosystem (!) rewrite "from the inside". So I'd better ignore it. You know, it's almost never too late to switch to a shiny new tech, but God forbid to do that too early.
@qm3ster
@qm3ster Жыл бұрын
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 Жыл бұрын
The word "Effect" itself is already very traumatizing
@FlanPoirot
@FlanPoirot Жыл бұрын
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 Жыл бұрын
@@FlanPoirot useEffect
@bansh3ee
@bansh3ee Жыл бұрын
@@FlanPoirot if everything is a side effect, is there any intended effect?
@FlanPoirot
@FlanPoirot Жыл бұрын
@@brunokotesky5965 well react is kind trash (imo), and useEffect is only very very distantly related to the effects being used here
@vitiok78
@vitiok78 Жыл бұрын
And people say Go has bad error handling. if err is 1000 times better than try - catch
@ThePrimeTimeagen
@ThePrimeTimeagen Жыл бұрын
agreed
@jessejayphotography
@jessejayphotography Жыл бұрын
..and then Go inexplicably skipped past pattern matching because they are masochists.
@danielvaughn4551
@danielvaughn4551 Жыл бұрын
The DBClient example reminds me of ObjectiveC protocols, though protocols are much clearer and explicit.
@olzk4705
@olzk4705 Жыл бұрын
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 11 ай бұрын
"Effect provides a better way" and then vomits all over the code.
Жыл бұрын
If TS is JS with types then what is TS with `Any` types and try/catch blocks? Hey Tom do you know?
@dinckelman
@dinckelman Жыл бұрын
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-.- Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@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 Жыл бұрын
​@@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 11 ай бұрын
​​@@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.
@andrueanderson8637
@andrueanderson8637 Жыл бұрын
Literally just ZIO for TS
@julianavar3836
@julianavar3836 Жыл бұрын
Wait, isn't this ZIO? I mean, it looks like TypeScript implementation...
@esse8407
@esse8407 7 ай бұрын
Yeah it's just ZIO but in Typescript, John De Goes gave a good speech about Effect this year
@chineduabalogu
@chineduabalogu Жыл бұрын
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
@KangoV
@KangoV 10 ай бұрын
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?
@Asto508
@Asto508 Жыл бұрын
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.
@cheaterman49
@cheaterman49 Жыл бұрын
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?
@AntonYefremov
@AntonYefremov Ай бұрын
I think these guys need to create a new syntax for that, aka .ets, .etsx , that will support describing all this concisely, while having all the benefits (concurency, traceability etc)
@JohnBuildWebsites
@JohnBuildWebsites Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
Whether or not it achieves that is another thing
@JohnBuildWebsites
@JohnBuildWebsites Жыл бұрын
@@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).
@DumblyDorr
@DumblyDorr Жыл бұрын
ZIO is my favorite ecosystem by far - and as much as I personally enjoy learning category-theory, "classical" FP has a quite high barrier to entry. Requiring half a math degree is a serious disadvantage in recruiting. Plus - cognitive load is a source of errors, so effect-systems which eschew category-theoretical jargon in favor of process-oriented concepts and terminology are IMO a very good way to make type-safe, composable, functional programming more accessible.
@br3nto
@br3nto Жыл бұрын
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.
@shubhambhattacharjee1111
@shubhambhattacharjee1111 11 ай бұрын
Fun fact an object having a then method can be used like a promise in js.
@bitcoindaddy748
@bitcoindaddy748 Жыл бұрын
my boy ZIO is getting into JavaScript ecosystem lol
@mikidep_old
@mikidep_old Жыл бұрын
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.
@josefjelinek
@josefjelinek Жыл бұрын
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...
@mfsbo
@mfsbo 7 ай бұрын
Agree with “typing strings is always a worry and should use something else”
@nightshade427
@nightshade427 Жыл бұрын
The depency injection part looks like ServiceLocator pattern
@minikame2272
@minikame2272 Жыл бұрын
Error, Value instead of Value, Error saves you the hassle of explicitely returning undefined
@aslilac
@aslilac Жыл бұрын
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.
@marble_wraith
@marble_wraith Жыл бұрын
jezus TS got vanilla'd?
@lowsca
@lowsca Жыл бұрын
Effect triggered my Coffeescript PTSD
@avi7278
@avi7278 Жыл бұрын
OK I just watched the video. I'm very excited about my next typescript project: Effect Effect Effect Effect Effect Effect Erect Effect Effect
@Lemmy4555
@Lemmy4555 Жыл бұрын
Are we going from wrapping every html tag in a react component to wrap every js line in an "Effect" call? 🤨
@AG-ur1lj
@AG-ur1lj Жыл бұрын
Prime says he is pushing 40, but his torso can’t be more than a day past 25.
@novarem9828
@novarem9828 Жыл бұрын
Sus 🤨📸
@badunius_code
@badunius_code Жыл бұрын
3:50 in which way is this better than just a promise chain?
@ybabts
@ybabts Жыл бұрын
I wrote something like this, but only the error handling. Just capture the errors as values and use type guarding to "handle" the errors.
@erickmoya1401
@erickmoya1401 Жыл бұрын
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.
@riptorforever2
@riptorforever2 Жыл бұрын
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.
@timothyvandyke9511
@timothyvandyke9511 Жыл бұрын
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 Жыл бұрын
hah, I WAS KIND OK
@theshermantanker7043
@theshermantanker7043 10 ай бұрын
Prime try not to be an asshole challenge (IMPOSSIBLE)
@kelvinsanyaolu995
@kelvinsanyaolu995 Жыл бұрын
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
@molasaheb6082
@molasaheb6082 7 ай бұрын
How is this different from rxjs ? All problems stated can be fixed using rxjs 18:40
@shankarsengupta1948
@shankarsengupta1948 Жыл бұрын
Functional programming has arrived for typescript.
@Robert-ht5kd
@Robert-ht5kd Жыл бұрын
If JS is a such a crappy language why it is used in so many places not related to the web? Latest example, Obsidian note taking desktop app.
@hypergraphic
@hypergraphic Жыл бұрын
Regression to the mean
@heroe1486
@heroe1486 Жыл бұрын
People only knowing JS, people wanting one language for their whole codebase, people wanting their project to be accessible to contribute
@Dennis-gg9yv
@Dennis-gg9yv Жыл бұрын
Obsidian is literally a fake web app (electron)
@isodoubIet
@isodoubIet Жыл бұрын
hammer syndrome
@Robert-ht5kd
@Robert-ht5kd Жыл бұрын
@@Dennis-gg9yv OK, what about Grafana K6?
@jkennethking
@jkennethking Жыл бұрын
"all languages are flawed, so.." is such a low bar to clear
@MaxHaydenChiz
@MaxHaydenChiz Жыл бұрын
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 Жыл бұрын
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.
@supqerior26
@supqerior26 Жыл бұрын
8:49 I agree. Just benchmarked Rust style custom Option and Result types in C# (I know...) to see how it's causing more allocation and GC for basic syntax sugar. But for some reason, people pushing this ideas because it's 'clean code' without realizing language itself doesn't play well with these concepts.
@vanjazed7021
@vanjazed7021 Жыл бұрын
You mean things like .map that take closures cause GC issues?
@supqerior26
@supqerior26 Жыл бұрын
@@vanjazed7021 No, I'm talking about custom types for example; Result MyMethod(Option option) instead of T MyMethod(T? option)
@supqerior26
@supqerior26 Жыл бұрын
@@MrFoxPro If your method throws exception too often yes, result type might be a good way to optimize but if it is a rare occasion, result type just causes extra gen 0 and gen 1 allocation for no reason unless it's a ref struct. Also there is a GC part, we might gain execution speed over throwing but in return we get extra GC spike so benefits are application specific and requires benchmarking.
@Thect
@Thect Жыл бұрын
Prime hiding all the muscles under that hoodie Is that hoodie some kind of power limiter or
@zeocamo
@zeocamo Жыл бұрын
in node error is first as there is only 1 error, but more paramers
@eero8879
@eero8879 Жыл бұрын
Or just pretend you are writing Go and always return [T, error] . Very simple and works.
@ybabts
@ybabts Жыл бұрын
Or you can just return a union type and not allocate unnecessary memory.
@IvanKleshnin
@IvanKleshnin Жыл бұрын
​@@ybabtsbut Go has no union types 😢
@ybabts
@ybabts Жыл бұрын
@@IvanKleshnin yeah but Typescript does. We're talking about Error handling in Typescript.
@Bliss467
@Bliss467 Жыл бұрын
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 Жыл бұрын
most smart tvs are just running android so you're just doing mobile dev
@PanosPitsi
@PanosPitsi Жыл бұрын
Java tv wtf man where did you buy that tv from hell 🥶
@bigmistqke
@bigmistqke Жыл бұрын
​@@PanosPitsiandroid
@theshermantanker7043
@theshermantanker7043 10 ай бұрын
​@@PanosPitsistill better than your shitty JavaScript
@badunius_code
@badunius_code Жыл бұрын
11:15 > uses `db` from outter scope > but how we would change it for testing > muyby use full DI? Or maybe show us how you put it there in the first place, clown?
@meppieomg
@meppieomg Жыл бұрын
It’s funny how prime spouts all these pieces of true wisdom but then completely collapses onto his own opinions and perceived used cases to bash something he clearly doesn’t really understand. Like the fuck you talking about device programming and hyper memory optimization when that’s obviously not the use case and isn’t relevant for 99% of apps or programs. Effect allows you to rapidly prototype, map your domain explore useful constructs and you can literally drop in a completely different implementation of a core service trivially if you need to test performance or interop with something else. The fact that he completely dismisses it based on his own assumptions of how it works without even glancing at the source code is disappointing. This project has been in the works for years and is the product of deep thought and care from people who have been using code like this in production. Reading the comments and watching the twitch chat just proves how ignorant people are. Anyone who knows anything would be extremely impressed by what they’ve created here.
@mikidep_old
@mikidep_old Жыл бұрын
Microsoft is doing some research on effect types as well, look up Koka
@vitiok78
@vitiok78 Жыл бұрын
"Library", "next generation" ... These are the spam words for me nowadays. Let's fix the fix with the fix that fixed that previous fix
@u9vata
@u9vata Жыл бұрын
Does JS do the same with asynchronity like C++ did with string type? To spend like decades to properly do some simple shit instead of this wtf?
@RemotHuman
@RemotHuman Жыл бұрын
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
@angelhdzdev
@angelhdzdev Жыл бұрын
Civet?
@Fanaro
@Fanaro Жыл бұрын
If they had debugging functionalities as well, would that fix your issues?
@hafermuech
@hafermuech Жыл бұрын
7:40 - generators?
@harshgandhi100
@harshgandhi100 Жыл бұрын
Prime without hoodie is something I never thought I will see in my life.
@jordixboy
@jordixboy Жыл бұрын
"A languages that transpiles to an interpreted language" lol... All languages includes assembly are "interpreted" by someone, in this case the cpu, java has its own "computer specification" aka virtual machine.
@cw6913
@cw6913 Жыл бұрын
Where the hell is the black hoodie, prime?
@NphiniT
@NphiniT Жыл бұрын
What does he mean by "V8 is not single threaded?" It's not??
@SJHunter86
@SJHunter86 Жыл бұрын
When are we getting Primeagen courses
@Spiun666
@Spiun666 Жыл бұрын
Its not like RxJS, its more like promise with typed errors and "environment" (context object). Which is what most JS backends end up implementing, over and over, manually. Why not benchmark the performance? :)
@Spiun666
@Spiun666 Жыл бұрын
Anyway I wrote a little something about this 8y ago and I wasn't very optimistic because we standardised something else (search for: ES7 async functions, a step in the wrong direction)
@zeocamo
@zeocamo Жыл бұрын
Vanilla JavaScript has been a thing for14/15 years now, FYI to anyone who don't remember the first 15/20 years of JS.
@bigmistqke
@bigmistqke Жыл бұрын
vanilla typescript not javascript
@zeocamo
@zeocamo Жыл бұрын
@@bigmistqke what typescript is only 10 years old, there was a lot of complier to JavaScript languages, some added types some was "prettier" etc
@bigmistqke
@bigmistqke Жыл бұрын
@@zeocamo the guy in the video mentioned 'vanilla typescript' not 'vanilla javascript'.
@aidandaniel1350
@aidandaniel1350 Жыл бұрын
A lot of these words go over my head - I'm a front end dev but feel like I have no deeper understanding of typescript or javascript, has anyone got some good resources to better my understanding? Would it also help to checkout other lower level languages ?
@redbenus
@redbenus Жыл бұрын
How is this any different from what things like rxjs offer?
@lucasqueiroz23
@lucasqueiroz23 Жыл бұрын
4:50 how can I start writing code for TVs?
@ryanleemartin7758
@ryanleemartin7758 Жыл бұрын
haskel is so glorious, you can only write whitepapers. gottem!
@br3nto
@br3nto Жыл бұрын
11:31 that looks like nightmare code 🫣🙈
@sub-harmonik
@sub-harmonik Жыл бұрын
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 Жыл бұрын
The service is written in TypeScript.
@Badboy99882
@Badboy99882 4 күн бұрын
Why not just abopt the error value return of go?
@pavloburyanov5842
@pavloburyanov5842 9 ай бұрын
Devs at 90' - we need to create lookup table of sin/cos. Devs today map map pipe recurse
@AaronMartinColby
@AaronMartinColby Жыл бұрын
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.
@njnjhjh8918
@njnjhjh8918 Жыл бұрын
It might not return a value, but it could always return an error
Migration Lesson: Don't Use Prisma | Prime Reacts
29:16
ThePrimeTime
Рет қаралды 164 М.
TS vs JSDoc | Prime Reacts
22:11
ThePrimeTime
Рет қаралды 97 М.
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 187 М.
This Library Turned my C into JavaScript wtf
2:06:38
Tsoding Daily
Рет қаралды 49 М.
javascript is dumb
46:04
Theo - t3․gg
Рет қаралды 118 М.
Why Effect is more important than ZIO by John A. De Goes (Effect Days 2024)
33:42
Effect | TypeScript at Scale
Рет қаралды 10 М.
32 Reasons WHY TS IS BETTER Than Go
1:09:29
ThePrimeTime
Рет қаралды 264 М.
MAXIMUM CRINGE Programming Language Tier List | Prime Reacts
22:45
ThePrimeTime
Рет қаралды 614 М.
Dear Functional Bros | Prime Reacts
26:03
ThePrimeTime
Рет қаралды 259 М.
How GO Was Created - Less Is More | Prime Reacts
28:15
ThePrimeTime
Рет қаралды 150 М.
Stop Recommending Clean Code
27:05
ThePrimeTime
Рет қаралды 559 М.
Why Svelte is BETTER Than React | Prime Reacts
11:28
ThePrimeTime
Рет қаралды 180 М.