3 ms·
Hah, I was worried I was alone in thinking that (or at least, something very similar). When he went into concrete examples of defunctionalization, I saw that it
by SilasX 7y ago
Hah, I was worried I was alone in thinking that (or at least, something very similar). When he went into concrete examples of defunctionalization, I saw that it was Haskell (or some ML-style functional language), and I rolled my eyes.
I thought, "Okay, great, you're working in a language where you already effectively have to think of it as, 'I'm not telling you how to do this, just defining the concepts.' Fine, but the language has already done most of the work that you ascribed to defunctionalzation. It's already very highly abstracted."
I would have hoped to see defunc appended to an environment that didn't already have the functional lattice to build off of.
And for my part, yes, I have worked with Haskell, enough to do some programs in Project Rosalind and build some codebreakers for classical ciphers, but I still find it hard to read and debug. It just isn't conducive to conceptually breaking down what the code is doing into bite-size pieces. That's probably because I, like most programmers, probably grew up with a procedural mindset and started from languages that enforce procedural thinking. But I suspect it goes beyond that, in being harder to reason about logic as "apply this function to this function to this function which operates on this".
- Smaug123 7y ago> Okay, great, you're working in a language where you already effectively have to think of it as, 'I'm not telling you how to do this, just defining the concepts. I don't think this is really the same thing. You're discussing the object level; I'm discussing the meta-level. Haskell is based around "define the concepts as you would naturally define them and I'll use that definition to create a program". However, this is entirely implicit in the language. Defunctionalisation explicitly reifies this, allowing the language to discuss how it does it. I see your point as basically "what's the use of continuations? I already have `goto`".
- SilasX 7y agoI confess a lot of this is over my head. So, not a lot to contribute further here. However: >I see your point as basically "what's the use of continuations? I already have `goto`". If I were trying to convince skeptics about the merits of structured programing (i.e. no goto), I wouldn't start from Java and merrily introduce try/catch in that context. I start from a BASIC program, explain the semantics of e.g. a while loop, and replace some program's gotos with while loops, and then tackle increasingly "stubborn" gotos. And yes, I hope you would be able to explain the benefits of continuations to a goto-fanatic, regardless of how much inferential distance there is.