The dream of declarative programming

I wonder why you're skipping the unnecessary overhead part.

I'm not.

I consider GC and syntactic overhead actual overhead not to mention the cognitive overhead of X different array types.

I explained the C-heap-based arrays that are described on the page you linked to. "Syntactic overhead" is a canard only brought up by those who can't be bothered to learn a new language. "Cognitive overhead" ditto: you pay that price once so you know when to use which type, and once you have, you have.

Haskell is nice if you drink the entire type theory and monad/category theory kool-aid but don't tell me mutating arrays in Haskell is as simple as doing the same thing in C...

Once you know Haskell, mutating arrays in Haskell is as simple as doing the same thing in C. If you want a little syntactic sugar, OK:

-- syntax sugar used for array:
arr <- newArray (0,9) 0 :: IO Array Int Int
(arr,0) =: 1
b <- val (arr,0)
print b

Feel free to replace Array with StorableArray above. That's part of the point.

...or the fact that I'm unwilling to put up with the cognitive overhead of X different array types that I'm somehow being hysterical.

You're being hysterical.

One thing I learned studying graduate level math is that there are many different ways to skin a cat. Infinitesimals in calculus being an excellent example. You can use a non-standard approach, synthetic approach, or epsilons and deltas. Each has something to offer but they're not all equally good for all tasks. The same holds for programming languages and the fact that programming language evangelists don't admit this is in my mind what is hysterical.

You asked (implicitly) about mutation. You asked explicitly about arrays. You asked explicitly about garbage collection. You linked to a page with all of the information you asked for either on it, or at most one more link away. You didn't say anything about syntax, which is a good thing because reasonable people know, yes, you need to learn a new syntax to use any new language. You didn't say anything about "cognitive overhead" because reasonable people know that's code for "intellectually lazy."

We get it: you don't like monads. You don't like types. So anything anyone can tell you that's actually directional to your question you'll handwave away the only way you can: by shrieking "Lions and Types and Monads! Oh my!" Because the truth is, you can use GC-safe, in-place mutated, unboxed, aligned arrays in Haskell very idiomatically from the perspective of anyone coming from a C background—you can even pass them to C functions, get them back from C functions, etc. etc. etc. You raised a non-issue, and now you're trying to furiously backpedal, and the only place you have to go is "I don't like types and monads."

You know what? That's fine. It's OK not to like types and monads. But claiming the issue is something else is one of two not-mutually-exclusive things:

  1. Intellectual dishonesty.
  2. Hysteria.
/r/programming Thread Parent Link - programmers.stackexchange.com