News for hackers. Stuff that matters.
Re:Functional programming is not popular because it is weird... by Tainnor on Tuesday September 14, 2021 @10:01AM (#28524937)
I find that OOP languages (as long as they support FP and immutability) have the benefit of using classes as nothing more that first-class parameterised modules (without any mutable state) so I don't have to repeatedly pass arguments from one function to the next but can look them up from a shared context. Haskell doesn't really have that option, although people have told me that OCaml can do that.
Re:Functional programming is not popular because it is weird... by playing_colours on Tuesday September 14, 2021 @02:56PM (#28529296)
You are describing the way I wrote in Scala, and now in Python: using class instances as that are initialised shared contexts like shared database connections, serialisers, etc.
Re:Functional programming is not popular because it is weird... by sfvisser on Wednesday September 15, 2021 @03:02AM (#28536105)
Yes, classes as glorified Reader monads :)
Re:Functional programming is not popular because it is weird... by adverbly on Tuesday September 14, 2021 @07:22PM (#28532891)
This is exactly how I roll these days! Avoid classes until I find myself doing too much argument plumbing, or having too many arguments to a function. Also love me some memoization. If I'm honest, I haven't tried aggressively using closures, but I suppose that would have been another way to do it...
Re:Functional programming is not popular because it is weird... by chromatin on Tuesday September 14, 2021 @10:38AM (#28525504)
This is exactly how I use D!