News for hackers. Stuff that matters.
Re:Rust Performance Pitfalls by steveklabnik on Thursday June 08, 2017 @01:01PM (#14515464)
We actually did have this once, but it wasn't really worth it, so it was removed. https://news.ycombinator.com/item?id=6940624 is the HN discussion, but it looks like the link might now be wrong?

It was also a very, very long time ago, and so today's Rust might be different enough that those reasons don't apply any more.

Re:Rust Performance Pitfalls by tormeh on Thursday June 08, 2017 @02:30PM (#14516073)
The reason at that point vis that there weren't any practical benefits and that it was preferable to wait for a more general mechanism. The first claim is dubious, but I can empathize with second, as long as it doesn't become tacked on.

Haskell can do cool optimizations that make it feel like magic sometimes.

Re:Rust Performance Pitfalls by Gankro on Friday June 09, 2017 @12:43AM (#14519219)
Note that a lot of these optimizations aren't necessary in Rust -- e.g. list fusion is only valuable in Haskell because mapping over lists is exposed as a one-shot operation that produces a new list. So `map map map list` is conceptually building 2 whole lists of temporaries you don't care about (and you often don't actually care about the last one either, in cases where you just iterate over it and discard it).

Meanwhile mapping in Rust generally takes an iterator and produces another iterator that will apply the given closure to the current element as it's yielded. So the naive codegen for iter().map().map().map().collect() is exactly what list fusion is trying to produce -- no temporary lists.

TL;DR: making "map" having the monadic `T[U] -> T[V]` signature is really expensive. ¯\_(ツ)_/¯

Re:Rust Performance Pitfalls by steveklabnik on Thursday June 08, 2017 @02:38PM (#14516129)
In some ways, const fn reminds me of this.
Re:Rust Performance Pitfalls by radarsat1 on Thursday June 08, 2017 @04:02PM (#14516789)
> We actually did have this once, but it wasn't really worth it, so it was removed.

Ah, yeah I had a vague memory that that was the case, which is why I asked.. I seem to recall it being removed, but I only follow Rust news, don't use it, so I wasn't sure of the reasons or implications.

Re:Rust Performance Pitfalls by stcredzero on Friday June 09, 2017 @12:42PM (#14522543)
I think that being able to enforce purity would be fantastic for actors, agents, and/or game loops.

https://news.ycombinator.com/item?id=8609775