News for hackers. Stuff that matters.
Re:How to Stop Functional Programming by jmmv on Sunday September 21, 2025 @12:32PM (#45324200)
Missed chance to do something like:

  class User:
    def calculateCoworkers() = {
      this.coworkers.clear()
      for { d <- this.departments }
        this.coworkers ++ d.employees
    }
and then, somewhere else...

  user.calculateCoworkers()
  ... many lines after ...
  for { c <- user.coworkers }
    ... do something ...
Yes, I've seen code like this many, many, many times where class members are used as "global variables" to pass state across functions. And I've noticed AI likes to generate code like this too (possibly because of the former (large presence of this "pattern" in the training data), which means I'm encountering this now in pull requests...
Re:How to Stop Functional Programming by sevensor on Sunday September 21, 2025 @07:04PM (#45327463)
Bonus points if you do half the calculation in the parent class and the other half in a child class. Double bonus points if one or both of them also hits a database.