▲ 77 ▼ An opinion on what's a good general-purpose programming language (avestura.dev) submitted 3 years ago by learnbyexample@programming.dev to c/programming@programming.dev 88 comments fedilink hide all child comments
[–] scottyjoe9@sh.itjust.works 10 points 3 years ago (2 children) I'm surprised that he didn't mention Rust when talking about type inference. The way it does it is excellent. permalink fedilink source hideshow 4 child comments replies: [–] cgtjsiwy@programming.dev 5 points 3 years ago (2 children) The author wanted "a more powerful type of inference that can actually infer the whole type of a function by analyzing the body of the function", which Rust doesn't have by design. permalink fedilink source parent hideshow 4 child comments replies: [–] philm@programming.dev 3 points 3 years ago Which I personally think is a good decision, although I like the clean looking syntax of Haskell, it's often not obvious what the function takes (which is why most are type annotating their function) But Rusts type annotations have non the less its limitations, when excessively using traitbounds (but I hope that will be soon better with impl everywhere (see e.g. https://smallcultfollowing.com/babysteps/blog/2022/09/22/rust-2024-the-year-of-everywhere/)) permalink fedilink source parent [–] naonintendois@programming.dev 2 points 3 years ago I really prefer rust's approach. The function signature is the contract. It makes it much easier to debug compared to overly generic pure functional code or c++ templates where everything is auto and perfect forwarded. The only time in rust where this isn't true is with async functions. That's because the compiler adds a ton of sugar to make it easier to write. permalink fedilink source parent [–] hairyballs@programming.dev 4 points 3 years ago Uh, not really? It's quite average compared to a complete inference like in Haskell and the likes. permalink fedilink source parent
[–] cgtjsiwy@programming.dev 5 points 3 years ago (2 children) The author wanted "a more powerful type of inference that can actually infer the whole type of a function by analyzing the body of the function", which Rust doesn't have by design. permalink fedilink source parent hideshow 4 child comments replies: [–] philm@programming.dev 3 points 3 years ago Which I personally think is a good decision, although I like the clean looking syntax of Haskell, it's often not obvious what the function takes (which is why most are type annotating their function) But Rusts type annotations have non the less its limitations, when excessively using traitbounds (but I hope that will be soon better with impl everywhere (see e.g. https://smallcultfollowing.com/babysteps/blog/2022/09/22/rust-2024-the-year-of-everywhere/)) permalink fedilink source parent [–] naonintendois@programming.dev 2 points 3 years ago I really prefer rust's approach. The function signature is the contract. It makes it much easier to debug compared to overly generic pure functional code or c++ templates where everything is auto and perfect forwarded. The only time in rust where this isn't true is with async functions. That's because the compiler adds a ton of sugar to make it easier to write. permalink fedilink source parent
[–] philm@programming.dev 3 points 3 years ago Which I personally think is a good decision, although I like the clean looking syntax of Haskell, it's often not obvious what the function takes (which is why most are type annotating their function) But Rusts type annotations have non the less its limitations, when excessively using traitbounds (but I hope that will be soon better with impl everywhere (see e.g. https://smallcultfollowing.com/babysteps/blog/2022/09/22/rust-2024-the-year-of-everywhere/)) permalink fedilink source parent
[–] naonintendois@programming.dev 2 points 3 years ago I really prefer rust's approach. The function signature is the contract. It makes it much easier to debug compared to overly generic pure functional code or c++ templates where everything is auto and perfect forwarded. The only time in rust where this isn't true is with async functions. That's because the compiler adds a ton of sugar to make it easier to write. permalink fedilink source parent
[–] hairyballs@programming.dev 4 points 3 years ago Uh, not really? It's quite average compared to a complete inference like in Haskell and the likes. permalink fedilink source parent