2 ms·
> an object is a struct with associated functions And inheritance and polymorphism, which I don’t think you can reproduce with closures.
by commandlinefan 4y ago
> an object is a struct with associated functions
And inheritance and polymorphism, which I don’t think you can reproduce with closures.
- Jtsummers 4y agoInheritance and polymorphism: https://okmij.org/ftp/Scheme/oop-in-fp.txt https://okmij.org/ftp/Scheme/oop-in-fp.txt The link at the bottom is dead, but here's the same file at his current site: https://okmij.org/ftp/Scheme/pure-oo-system.scm https://okmij.org/ftp/Scheme/pure-oo-system.scm You can reproduce these with closures, though you'll need more plumbing since it's not built into the language.
- commandlinefan 4y ago> more plumbing since it's not built into the language Well, sure - you can "reproduce" encapsulation, inheritance and polymorphism in plain-old C (heck, I've done it in Cobol), too. I'm not sure that's really the same, though.