Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

Do Rust newbies also complain about the lack of exceptions like in Goland (myself included even understanding their reasons..) ?


No because Rust offers a more natural way to deal with them, instead of ifs everywhere.

Also known as railway programming in FP circles.


> railway programming in F# circles

FTFY


Pretty sure pjmlp meant Functional Programming.


"Railway Oriented Programming" is a term coined by Scott Wlaschin, a prominent F# practitioner who popularized the term with helpful blog posts, slides, and speaking events.

Outside of the F# community (i.e. those that have not seen Wlaschin's materials) however, the term is rarely used. The larger FP community has more more general terms they use instead for the whole class of patterns surrounding this.


You are correct. I just thought the term was more widely known outside the F# world.


well it could be, I certainly don't speak for everyone; just haven't seen it personally myself yet.


Rust's error handling is pretty good. First of all you see in the signature of the function that it can trigger an exception, so such a function will return Result<T, E> instead of just T. This is similar to Option, Either or Try in Scala, or to Maybe / Either in Haskell. To easily pipe such errors, Rust provides a try! macro, which just expands into a catch block.

Rust is less functional than Haskell or Scala, so I don't know how that works out, but in FP languages it ends up working great. Also, compared with Go it isn't the same thing.


Rust targets C++ programmers (Go seems to be targeting Python/Ruby web devs), the former are used to not using exceptions even when they exist in the language (for various reasons, some valid - some not so much :) )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: