miloignis 2 years ago

I'm not a huge fan of this post - I feel like it adds to the confusion where it tries to enlighten.

First, a pedantic point - a proper pure functional language will not have "side effects", it will have "effects" (either through algebraic effects or through monads or something) - nothing "side" about them. Side effects are effects that happen in addition to the main value of doing something (this medicine has side effects). Effects are just things that you want to happen in the world, and many functional languages reason about them as first class objects instead of implicit behaviors. That is, a function has an IO effect or returns a value in the IO monad instead of being a C function that can arbitrarily write to the file system.

Second, the main point of the post seems to be that functional programming will not make concurrency happening outside of the language (say, when talking to databases) safe, but that's a pretty simple point that's not stated as clearly as it could be.

Hopefully I'm not being too harsh - I might have misunderstood something, and the core point that functional programming doesn't magically fix everything is true - but it's that very confusion that I think makes this post unhelpful.

  • karmakaze 2 years ago

    The post is entirely useless from any technical perspective. It talks about pure FP languages. Then about OCaml and concurrency without much detail or distinction.

    The only useful thing it almost says clearly is that FP doesn't have to be magic and can be used effectively by normal folks, but instead flips the title (for clicks) to imply it's not as good as they say.

  • chongli 2 years ago

    Thank you. I’ve frequently found myself annoyed when people conflate the terms “effects” and “side effects”.

    • cameronfraser 2 years ago

      I like to think of "effects" in this context as "managed effects"

Veliladon 2 years ago

Any sufficiently advanced technology is indistinguishable from magic.

It's magic. Functional programmers are witches/warlocks. What else is the turbofish other than an arcane rune for magical purposes?

  • piaste 2 years ago

    > What else is the turbofish other than an arcane rune for magical purposes?

    I'm reminded of the Codeless Code short story where the young acolyte visits a Haskell monastery, looks upon an engraving of the monad definition, and wonders "and this mystical inscription - this is code?"

abc_lisper 2 years ago

OTOH, It does seem like magic if you have dealt with Java in your previous life

  • karmakaze 2 years ago

    I dunno if I'd say that. At least using recent versions of Java and some F#, I find the latter much nicer, but don't do things so extremely differently. It's just more concise and less keyboard typing when refactoring.

    Having worked with Rails codebases I tend to avoid magic when not needed.

    The best effect is using FP, then going back to what you used before and adopting more FP style: single assignment to local vars, immutable datastructures, less imperative control flow, etc.

    • pharmakom 2 years ago

      The major differences between Java and F# are:

      - Discriminated unions and pattern matching

      - Global type inference

      - Tail call optimisation

      - Syntactic sugar for monadic code (computation expressions)

      Java is more “FP” than it used to be, but it is still not minimum viable FP

      • kaba0 2 years ago

        Java has sum types and is in the process of getting pattern matching (some basic form is already available, but `case Sphere(Point(int x, var y), var r)` already works in preview).

        For sum types, the syntax is like this:

          sealed interface Expression permits Add, Mult, Identifier {}
          // possibly later
          record Add(Expression a, Expression b) extends Expression {}
          record Identifier(String name) extends Expression {}
        
        I do like global type inference, but for anything that gets committed I often come to prefer at least Rust’s restriction of top level definitions needing types, as that aligns well with how I would also write Haskell and alia. Java imo made a good decision of only adding optional local inference, anything else would have been too disruptive for Java, given its existing talent pool’s background.
      • karmakaze 2 years ago

        Definitely I would not call Java an FP language, even Rust has a flavoring of FP. Besides the monadic constructs not having proper sum types/d.unions is really annoying. Sealed enums are not the same utility.

hajile 2 years ago

Why no mention of safety?

On the whole, the type safety guarantees of something like StandardML over something like Golang are at least as valuable as many of the more traditional "functional" aspects.

nh23423fefe 2 years ago

conflating FP with immutable data structures or with referential transparency and then bashing FP seems pointless.

No one says FP is panacea. Why are you refuting words you put into imaginary novices mouths. Engage with good ideas instead of shooting down bad ideas no one holds.

> what I call FPF ... emanates from people who’ve recently discovered FP ... and have yet to realize that — like all programming innovations since the 1940s — it doesn’t actually solve all the problems for us.

tabtab 2 years ago

Most rank and file business and administrative apps don't need "direct" concurrency. The web server and database provide it more or less automatically most of the time, if you don't do anything "odd". If you disagree, I'd like to exam a relatively common scenario.

anupamchugh 2 years ago

This guy is spamming Medium everyday. Has been banned on a few occasions, but creates a new account, writes nonsense and then shares it on HN and Reddit