OOP is not that bad

3 pointsposted 7 hours ago
by todsacerdoti

1 Comments

Zababa

4 hours ago

In that specific article, "OOP" seems to be mostly about dependency injection and structural typing, ie you can pass to a function a Logger, all Loggers have the same interface but they do different things.

In Go this could be a function or a constructor (that are also functions) that takes a Logger interface.

I only have vague knowledge of Haskell but I think you could achieve this by having Logger be a record, containing the different functions, and pass different "implementations" of Logger to functions that need them?