8:40 functions in rust already have a type that is unique to each function, and they all implement traits those being Fn FnMut and FnOnce, they also are implicitly converted to fn pointers when necessary idk if that is done through Deref. Closures are similar, with the exception they can't be converted to fn pointer if they capture any variables. The behaviour you are looking for is almost what we have with the Fn traits and closures, that being implicitly implementing the trait based on how the closure interacts with its environment, the only difference being you want the trait to be implemented if a function called implements it. At some point it will need to implemented explicitly, especially if you want to allow custom traits, which may or may not have to be marked as this special kind of trait. btw fun fact the Fn traits are actually the traits for the fn call operator so you can impl them on a struct and call it like a function tho there is a caveat that you need to some funky dereferencing to convince the compiler that it is a function, something like (&&T)()
@timClicks7 ай бұрын
Thank you so much for the added context. When recording this ad lib, those details were not coming to me!
@ericshimizukarbstein68857 ай бұрын
I personally feel that coloring in effect system languages is sort of different. All langs I saw that have effect system have a syntactic unified way to handle effects, removing that effect coloring on the used function, so if you have a function f1 that has the IO effect and you use it in function f2 but f2 handles IO effect inside, it won't have the IO effect
@timClicks7 ай бұрын
The difficulty for Rust would be how to create that unified feel when effects would need to be bolted on to a pre-existing language. However, my own knowledge is quite limited in this area which is one of the reasons why I published this video. I was hoping to foster some of the informed discussion like your comment. Thank you!
@ericshimizukarbstein68857 ай бұрын
Yeah, I agree on that difficulty for Rust, and I don't even have an idea of how that could be accomplished for Rust. My knowledge in this area is also limited, I just have about a couple of months of experience trying and reading about effect system languages, but that aspect was the thing I saw in common between the 4 languages I tried out. Thank you for bringing that subject up! I think these should be discussed more and on more platforms!
@JhraumG7 ай бұрын
No matter the resolution I choose, the video is at 14fps 🧐
@superstarben377 ай бұрын
Completely offtopic, is there any particular reason why this video is at 1080p 14fps? It's definitely *very* choppy, almost distracting even
@LibreGlider7 ай бұрын
Its at 2160p for me def not 14 fps.
@timClicks7 ай бұрын
14 fps sounds very odd. Perhaps YT is downscaling to conserve bandwidth? Try selecting your own quality with the gear icon.
@Hellbending7 ай бұрын
Yeah, I'm with you on this one mate, hellaaaaaaaaa choppy idk what's happened here
@zachhoward93367 ай бұрын
Same
@MarcusBrito7 ай бұрын
Good discussion, Tim. A lot of people already think Rust is too complex, adding an effect system is bound to make that worse - unless we can make it completely opt-in; not like async where it taints/colors return types, but truly opt-in, as in you could write a program with effects disabled while using effects-awae libraries. I don't know how that could be done. Even if that could be done, do we want Rust to become one of those languages so full of features that very few people can master it, like C++, or some might add, Scala? Rust today might not be simple, but it's very composable; there are a few building blocks (functions, traits, lifetimes), and after you get them, you get everything else.
@timClicks7 ай бұрын
Thanks Marcus. I'm not sure either. I presume that's why it will take a lot of delicacy to design.