4

You can't define protected class members in F# due in part to how they complicate the functional nature of the language. (The Book of F# - Dave Fancher).

I am new to functional programming, and the book does not explain details about it. So, how exactly they complicate the functional paradigm? Can anyone explain it better?

Ismael
  • 622
  • 6
  • 11
  • 5
    Here's a plausible explanation why using protected would be a pain: http://stackoverflow.com/questions/2390515/why-isnt-there-a-protected-access-modifier-in-f – scrwtp Dec 06 '16 at 22:43
  • 1
    In short, it's more the other way round: functional nature of the language would complicate using `protected` if the language had it. – scrwtp Dec 06 '16 at 22:44
  • 4
    Yet another view on the same thing: Access level modifiers were invented to overcome certain OOP-related problems. Not to say that FP has no problems at all, they are, but different to the OOP's. Hence, `protected` appears to be merely useless in F# (plus it takes an effort to maintain). – Be Brave Be Like Ukraine Dec 06 '16 at 23:03
  • Never thought about the lambda problem. Interesting. Thanks for the link. – Ismael Dec 06 '16 at 23:06

0 Answers0