4 ms·
The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are
by AlexanderDhoore 6y ago
The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."
Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.
On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.
- politelemon 6y agoThis gave me a good chuckle. Who or what is Qc Na?
- saagarjha 6y ago> I'll take some koanic license and combine Norman Adams (alleged source of "objects are a poor man's closures") and Christian Queinnec ("closures are a poor man's objects") into a single great Zen language master named Qc Na. (From https://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html https://people.csail.mit.edu/gregs/ll1-discuss-archive-html/...)
- savingGrace 6y agoI felt as though I should know the moral of the story, yet I did not. https://stackoverflow.com/a/11421598 https://stackoverflow.com/a/11421598 Moral of the story is that closures and objects are ideas that are expressible in terms of each other, and none is more fundamental than the other. That's all there is to the statement under consideration.
- AlexanderDhoore 6y agoIt's code and state. Nothing more. Nothing less.
- jl2718 6y agoMy first computer book was: “Data Structures + Algorithms = Programs”. Thinking in this way has simplified my code tremendously. I think OO is taught because it’s more tactile. Literally it takes more keystrokes, and so much is pattern repetition that it facilitates learning and feels like progress. Functional is like learning Latin by studying Ovid one word at a time. When books (or mips) were expensive, this was how it was done. Even OO is old-school now though; today’s introduction to programming is mostly configuring CSS and webpack.
- jimmaswell 6y agoOO is just the most intuitive way to compartmentalize state to many people, me included.
- cessor 6y agoI feel the same way.
- atoav 6y agoIt often is, unless you solve a problem where it isn't (and at some point you will). Nowadays I try to be very pragmatic about these things, but before I had a certain realization I just wanted things to fit neatly in classes and saw some beauty in it. That was until I started using rust where this wish initially lead to a lot of frustration. When I finally gave in and did it the Rust "compositional" way, everything worked incredibly smoothly
- cessor 6y agoHow do you model changes in state over time? (i.e. effects and processes?)
- cessor 6y agoHow much great learning the student could have done if he had not been insulted and physically abused by an impatient "educator".
- deleted 6y ago[deleted]