Next Generation TypeScript | Prime Reacts

preview_player
Показать описание
Recorded live on twitch, GET IN

MY MAIN YT CHANNEL: Has well edited engineering videos

Discord

Рекомендации по теме
Комментарии
Автор

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.

calder-ty
Автор

This architecture is very common in Haskell. There are a few effects libraries and talks about them, if you want a taste of it

griof
Автор

He made a mistake at Effect.Effect <Effect> return Effect.flatmap(effect: effect)) : Effect

thebaconing
Автор

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

fire
Автор

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

terradtc
Автор

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.

steigerwalddaniel
Автор

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.

jesselawrence
Автор

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

makeshiftartist_
Автор

Disney+ was made with effect systems in Scala (Cats/ZIO), so they can be fairly efficient resource-wise.

felipevelasquez
Автор

Writing in this style in Scala with Cats Effect. It's quite nice actually.

pesiok
Автор

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

GAoctavio
Автор

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!

robmorgan
Автор

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<T, Err> = { 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

harleyspeedthrust
Автор

I am waiting for libraries for this Typescript library...

paca
Автор

Vanilla typescript - Vanilla typescript - Vanilla typescript - bossing the windup today.

seanknowles
Автор

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.

allalphazerobeta
Автор

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).

vnshngpnt
Автор

Is Effect a Library or a Framework?
Do you become a Effect programmer?

thingsiplay
Автор

OK I just watched the video. I'm very excited about my next typescript project:

Effect
Effect
Effect
Effect
Effect
Effect
Erect
Effect
Effect

avi
Автор

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

Bliss