5 ms·
> A person convinced of (and perhaps ego-invested in) the nonexistence of new possibilities is a person actively resisting their opportunity to discover possibi
by dahart 8y ago
> A person convinced of (and perhaps ego-invested in) the nonexistence of new possibilities is a person actively resisting their opportunity to discover possibilities — too stuck in the obvious to discover new truths.
Since this article is almost 10 years old... has any progress been made in demonstrating the existence of pure functional I/O? Reading files and writing to the console is one thing, I’m more curious about human input, GUIs and language. Think about apps Photoshop, Super Mario Bros, or Sublime text. The ways we want to interact with them seem more fundamentally sequential. Not only can I not see how to make them pure functional, I can’t see what that even means or why it would ever be desirable.
> Hand-waving is an important factor in staying stuck in impossibility thinking, since rigorous argument uncovers unconscious limiting assumptions.
You have to admire the effort to discredit any rational thinking before it starts.
- heavenlyblue 8y ago>> Reading files and writing to the console is one thing, >> Think about apps Photoshop, Super Mario Bros, or Sublime text. Well, there's literally no difference between reading from a file or from a queue of requests from the user on any level of abstraction. E.g. you could (functionally) apply a list of operations to an image in Photoshop that the user has supplied you with.
- dahart 8y agoThere is a big difference between reading files and human interaction. You don’t normally have to output intermediate state while reading a file, but you do with human interaction. Human interaction is usually responding and reacting to intermediate the state of the program. Think a bit more about Super Mario Bros. A file can be read as a single chunk of memory, and it doesn’t need to consist of a queue of sequential operations. We can decide and design what files are and what’s in them. An array in a file doesn’t need to be read one number at a time. Human interaction, unlike a file, cannot happen all at once, needs intermediate feedback, and cannot be reordered or easily reformulated into another representation, because it’s responding to the intermediate state of the system.
- zachrose 8y agoBut we can imagine a program that reads a file byte-by-byte and where some internal state of the program changes depending on those bytes. This program could even exit when given three “#” characters, which might mean you need an internal counter for each “#”. In that sense Mario isn’t really that different! (Subtly, a purely functional Mario game has more inputs than just the controller. You’ll need a clock signal for the Koopas to walk around at a given pace, but that’s not too different from a file of sequential numbers that’s read at a particular speed.) Backstory: I used to think that front-end JavaScript programming was too stateful and inherently messy to be compared with, say, handling HTTP requests. But the Elm language (and to a lesser extent React/Redux) has shown me that the messiness is accidental. You actually can apply the techniques of purely functional programming to create arbitrarily sophisticated GUI programs. Here’s a simplified version of Mario in Elm: https://github.com/avh4/elm-mario. https://github.com/avh4/elm-mario.)
- dahart 8y agoNo, you missed the point. The human input depends on the intermediate state, where the file input does not. Manufacturing a case where you output the intermediate state as you read a file is missing that crucial dependency. You must also assume that the human input cannot be predicted before the intermediate state is known. Assuming that it’s a function of time is cheating. > You actually can apply the techniques of purely functional programming to create arbitrarily sophisticated GUI programs. No, you can’t. That’s exactly what this article is talking about. React is a state machine under the hood. You can handle each request in a functional way, but you can’t build the request processing behind the scenes in a function way, it’s not currently possible. However, from your point of view, all of your code can appear to be functional, so some of the comments here are, reasonably, asking the question, why does it matter?
- zachrose 8y ago> The human input depends on the intermediate state, where the file input does not. Not sure what you mean by “depends” here. If I’m at a game controller I can smash buttons for years without caring what the state of the game is. It’s up to the game to make sense of those button presses and do the right thing.