this post was submitted on 06 Jul 2023
78 points (100.0% liked)

Programming

17026 readers
176 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 11 points 1 year ago (2 children)

I'm surprised that he didn't mention Rust when talking about type inference. The way it does it is excellent.

[–] cgtjsiwy 5 points 1 year 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.

[–] philm 3 points 1 year 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/))

[–] naonintendois 3 points 1 year 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.

[–] hairyballs 4 points 1 year ago

Uh, not really? It's quite average compared to a complete inference like in Haskell and the likes.