R
Raphael Poss
science.raphael.poss.name · Personal blog · on HN since 2014
Raphael Poss writes technical posts on Rust, Go, Haskell, OCaml, category theory, and low-level performance measurements.
What HN saysHN commenters cite his Rust-for-functional-programmers article in debates over whether Rust is functional, and praise his category theory primer.
34HN people shared it
18linked it in comments
23stories submitted
446story points
5 years agolast shared
2014people per year2026
Most-shared posts
- 1Rust for functional programmers15 people · 208 points · first shared 2014 · 52 comments on HN
- 2How Good Are You At Programming5 people · 28 points · first shared 2014 · 30 comments on HN
- 3The Go low-level calling convention on x86-645 people · 6 points · first shared 2018 · discussion on HN
- 4Haskell for OCaml programmers4 people · 59 points · first shared 2014 · 13 comments on HN
- 5Measuring multiple return values in Go and C++3 people · 9 points · first shared 2018 · discussion on HN
- 6Size visualization of Go executables using D32 people · 125 points · first shared 2019 · 53 comments on HN
- 7The Dark Resistance1 people · 6 points · first shared 2014 · discussion on HN
- 8Measuring errors vs. exceptions in Go and C++1 people · 2 points · first shared 2018 · discussion on HN
- 9The 4th law of programming language comparisons1 people · 1 points · first shared 2016 · discussion on HN
- 10Open Problems in Computer Science1 people · 1 points · first shared 2014 · discussion on HN
- 11Finding the right tool for the job – FAIL1 people · 1 points · first shared 2014 · discussion on HN
- 12Poss.15.tpds.pdf1 people · first shared 2018
- 13Categories from scratch1 people · first shared 2016
- 14Poss.13.micpro.pdf1 people · first shared 2018
What HN people wrote when they linked it
knz42 · 2020-01-02
I'm the author of the article linked in this entry and https://science.raphael.poss.name/go-calling-convention-x86-64.html, and this is IMHO the best comment in this thread.
bringtheaction · 2018-01-17
Some would say that Rust is a functional language.
http://science.raphael.poss.name/rust-for-functional-programmers.html
Rust has an ecosystem for building web backends.
http://www.arewewebyet.org/
Does Rust have the best ecosystem for a web backend, though? I think that will depend on who you ask and what you are looking for specifically.
louthy · 2016-09-30
This is a great primer on Category Theory
http://science.raphael.poss.name/categories-from-scratch.html
jnbiche · 2016-02-23
> I'd love to hear the argument that says that it is...
http://science.raphael.poss.name/rust-for-functional-programmers.html
I personally think Rust isn't functional, but rather multi-paradigm with a strong functional influence. But if you were to add TCO and a few other features, I think Rust would be a full-blown functional language, so it may get there yet.
In any case, it's useless arguing over (should have known better than say anything), so this will be my last word on the issue.
klibertp · 2015-06-22
> and you wouldn't use it in your code
Speak for yourself. I don't see any value in not using a tool when it's available and seems to do the job:
http://science.raphael.poss.name/haskell-for-ocaml-programmers.html#pr…
Personally I don't believe in 100% pure FP, it's both a pain in the ass and doesn't really give you more than 85% FP already would. Actually, most of the FP world seems to agree: out of many Lisps, Scala, OCaml, SML, F#, Erlang/Elixir etc. only Haskell is that hell-bent on purity. Even things like PureScript are more pragmatic than Haskell in this regard.
Here's a great talk on getting what's best from FP without also taking all the problems: http://www.infoq.com/presentations/functional-pros-cons
thirsteh · 2015-01-12
Sure -- basically what you said: http://science.raphael.poss.name/rust-for-functional-programmers.html#…
Of course it's not exactly Haskell, but it's arguably closer to FP than it is to C, yet manages to be approachable to imperative programmers. I think this is fantastic.
vegabook · 2017-02-27
As a scientific programmer interested in functional-flavoured (ie undogmatic) languages, I would do Rust immediately if it had a REPL. Dying to dump Python. This post is very convincing on Rust's design decisions:
http://science.raphael.poss.name/rust-for-functional-programmers.html
This post was a total revelation to me, even if I assume it's well known in the community, because it is very credible on the Sophie's Choice issue of mathematical purity versus acknowledgement of the reality of the instruction pointer-based imperative machine that exists underneath.
I've looked at other languages that "do" multiprocessing recently. Go is great, but it's essentially about getting large teams of variable-skill people to work together well. It's not an inspiring language, whereas Rust clearly is. Erlang (via Elixir) is very interesting, but the actor model will never be as performant in reality as the shared memory architecture. Julia is just a modern interpretation of matlab. A number of the JVM languages are great, but the "culture" of that ecosystem will always be corporate.
This is why I believe the science crowd could really gravitate to Rust, because it may have the ability, like the functional crowd, to satisfy the "search for beauty" aspect which motivates many academics, scientists, and indeed, programmers, all the while staying just the right side of pragmatism. And clearly targeting "where the puck is going" on massively multicore hardware.
The trial-and-error…
ycmbntrthrwaway · 2017-01-27
> It seems like everything I know about structuring a program goes out the window when borrowing comes into the picture.
Try to avoid structured programming and mutable state where possible. Apply functional programming idioms and use immutable data structures if you can. Rust adopts many features from functional programming languages: http://science.raphael.poss.name/rust-for-functional-programmers.html
Borrow checker will interfere only when you are trying to manage mutable state that is hard to reason about. If you absolutely must keep some mutable data structure around, you can fall back to unsafe code. There is nothing wrong with it, but make sure to put all unsafe code into separate module and provide only safe interface, that is absolutely unbreakable no matter how you use its public API.
Make sure you know about this module: https://doc.rust-lang.org/std/mem/ It is nearly impossible to create complex data structures without it, even linked list implementation requires it. Learn to use replace, swap and .take(). These functions provide great example of a safe API for unsafe operations.
marcus_holmes · 2019-04-05
which is useful, except as far as I'm aware it doesn't cover this case.
The original is at: https://science.raphael.poss.name/go-executable-size-visualization-wit…
cakoose · 2019-04-02
> as discussed in my previous article [1], Go uses memory instead of registers to pass arguments and return values across function calls.
[1] https://science.raphael.poss.name/go-calling-convention-x86-64.html
This is very surprising for a language that targets somewhat high performance.
Looks like it's a 5-10% performance hit, but makes it easier to provide good backtrace information: https://github.com/golang/go/issues/18597
nothrabannosir · 2019-04-02
The same author, Raphael Poss, has another post on it:
https://science.raphael.poss.name/go-calling-convention-x86-64.html
It's very extensive and informative.
japanuspus · 2018-11-26
Rust is actually a contender in this space as well [0]. It is not something that is widely touted, maybe because of a fear that an FP-label would give rust an academic tinge?
This is one of the reasons I will dedicate this year's advent of code [1] to learning rust.
[0]: https://science.raphael.poss.name/rust-for-functional-programmers.html
[1]: https://adventofcode.com/
tbenst · 2018-06-28
By reference to HM, I mean to illustrate that Rust has fundamental similarities to the typed lambda calculus, which has been done more formally by Rust Belt. Additionally, traits in rust are highly similar to type classes in, say, Haskell. Describing rust as a functional language is reasonable, see eg http://science.raphael.poss.name/rust-for-functional-programmers.html
axlprose · 2017-11-13
Here's a post that compares the two pretty well, though it assumes you know a bit of some ML-style language:
http://science.raphael.poss.name/rust-for-functional-programmers.html
jk4930 · 2015-10-20
I'd describe it more as uglyfied Haskell, but anyway: http://science.raphael.poss.name/rust-for-functional-programmers.html
st1ck · 2018-06-11
I spent around 30 minutes reading "Rust for functional programmers" [1] to get overall perspective and then around 3 hours more reading selected chapters from "The Book" [2] about borrowing, lifetimes etc.
Then I managed to write a simple program which reads a password from stdin, applies scrypt KDF to it and prints the result in hex encoding. It took me less than 2 hours. Mostly I just tried to do something, and when it didn't work, I'd find a solution for my problem on stackoverflow or r/rust. Compiler error messages were also quite helpful.
So I managed to write a useful (for me) simple CLI application in 1 day. The next day I added option processing (salt, scrypt parameters), split the code into functions etc. I didn't encounter any problem which I couldn't solve in under 1 hour. The biggest struggle was trying to return a reference to local variable from function, and it was covered in [3].
TLDR: don't try to master the language, just give it a try for a few days, writing a simple program.
[1] http://science.raphael.poss.name/rust-for-functional-programmers.html
[2] https://doc.rust-lang.org/book/
[3] https://bryce.fisher-fleig.org/blog/strategies-for-returning-reference…
dbaupp · 2014-09-17
I think the situation of your [1] is that Rust has ended up close enough to C++ that it's useful and meaningful to provide a translation guide between concepts, to help C++ programmers get up to speed more easily; it's certainly not a design document or anything like that. Maybe I'm missing your point. (As I said elsewhere, C++ has had a lot of experience in this space, and so has a lot of good ideas, Rust is not ashamed to borrow them.)
On that note, would you interpret [a] as meaning Rust is trying to be a functional language? The reality is more plagiaristic: functional language have nice features and so Rust borrows some of them. (In my mind the correct interpretation of both documents would be: Rust is a mesh of various languages with enough similarity to many for translation guides to be helpful.)
There has been syntactic decisions tilting towards C++/Java/C# programmers (like the <> for generics), but as far as I can remember those sort of decisions are all minor in terms of semantics. For the most part the actual semantic behaviours are considered in terms of "does Rust need this" rather than "will this move us more towards C++" (even if the feature was inspired by C++).
[a]: http://science.raphael.poss.name/rust-for-functional-programmers.html