by lacker · 6y ago · 0 comments
I don’t think so. What killed Haskell in mainstream programming is its weird syntax. Rust looks like C so it passed that first sanity check. People hate that something so aesthetically basic could define the success of programming languages, but it seems pretty clear at this point. Languages have to basically look like C in order to be popular.
Nothing in Haskell was sufficiently interesting to justify overcoming the conceptual barriers and different culture.
[1]:http://dev.stephendiehl.com/hask/#eightfold-path-to-monad-sa...
[2]:Regular expression tutorials, by contrast, virtually never attempt to explain regular languages or automata theory, which is why nobody complains about having to learn formal language theory in order to use `sed`.
A surprisingly digestible (and concrete) explaination of monads (Ch 2): http://www.cse.chalmers.se/~rjmh/Papers/arrows.pdf
They always go for the mathematical way of explaining stuff (this is not a compliment). Programmer English please, not Alien Math. (And that's me saying as someone who likes Alien math in general. But I just don't see the point in using it when programming).
Ok cool, your programming language now has two worlds, the functional world and the imperative world and they have two different syntaxes and you have to pass your world as an extra parameter and etc etc
And I personally find the syntactic sugar built on top of it confuses more than helps (ok, some of it is just Haskell being Haskell, but it confuses)
I program in C for a living, and no, Rust doesn't look like C. In fact, one of the things that keeps me away from learning Rust is that it is so complicated in terms of syntax.
Today I was reading this HN entry (https://news.ycombinator.com/item?id=24404628) and there is a little Rust code snippet towards the end, and I was thinking "this is so fck'd up, I'll never grasp Rust".
> Languages have to basically look like C
I wish they do.
"...perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away..." - Antoine de Saint Exupéry
Rust has an intentional well thought-out approach to what it makes explicit[1], which is useful in a language that is focused on control, correctness, and performance. It's not trying to make source code beautiful, it's trying to balance usability of the language with avoidance of surprises caused by implicit compiler magic.
[1]: https://boats.gitlab.io/blog/post/2017-12-27-things-explicit...
> there is a little Rust code snippet towards the end, and I was thinking "this is so fck'd up, I'll never grasp Rust"
After you mentioned it, I had to try to read it, and not programming in Rust, I'm surprised that there was a need to "clone" the "references" to the single value which would be accessed by each spawned thread using the "Arc" "reference counter."
A question for those who really know Rust:
As it is a single value, in C or C++ I could do the atomic access without any "cloning" and doing "reference counting" with something like "Arc" and it would still be safe. What am I missing? Was it necessary in Rust or was it an example of a demonstration that did more than actually needed?
For me, it's always more than just syntax that is to understand.
The core issue here is that it's not clear (from the snippet, but also to the compiler due to the type signatures) when the threads join. If they're joined in the same scope, they could use "scoped threads" instead, which would remove the need for the arc alltogether.
Thanks. Assuming the join indeed immediately follows the snippet, what were the needed changes in the type signatures in this case? I’d like to know the “good” and “idiomatic” example (which avoids doing more than needed) for that example.
After "It is sometimes necessary to manually drop the mutex..."
First, it’s the first language I’ve used in any capacity where I can’t mentally map the syntax. The orders of precedence are way too complicated, and the end result is that I end up blindly throwing $’s at the code until eventually it works. I have no idea why it has to be this hard.
Second, indentation. Seriously, indentation. Haskell is one of those accursed languages, along with Python, where indentation is apparently just utterly broken. I have yet to see A Haskell editor that can offer much more than the ability to cycle through the possible indentation levels given the context. It’s maddeningly bad, and often most editors can’t clean it up after the fact either.