Hacker News new | ask | show | jobs
by scoith 5054 days ago
Tbe reason that functional programming languages, including LISP, will never dominate the world is because most people are doing engineering, not maths or getting out CS papers.

CS people like to abstract away the computation from physical hardware, but the apparent fact is computation _is_ physical, and it's limits lie in physics and not in mathematics or philosophy (see Shor's algorithm for instance).

It's only natural to write programs in a language that follows the same flow as the underlying physical computer. A classical computer is represented by it's assembly language, thus it makes sense to have languages like C. Concepts like "stateless programs" don't even exists in a classical computer. It's as crazy as trying to build a quantum algorithm that does away with measurements!

In addition the physical world does not work anything like a stateless machine. As most useful programs imitate a physical process rather than a pure mathematical object, the notion of writing programs in such languages is not-intuitive and requires transformation of the actual problem at a both low (hardware) and high (software output) level.

Finally I would like to speculate that the whole concept will never be intuitive in the future (post-quantum computer era). In the era of quantum computers, because they will always be physical objects with a particular state, and it's this very fact that they have a well-defined state allows us to perform a computation.

1 comments

I don't think the relationship between a language's model of computation and the physical computing mechanism is particularly important. It's more important for a language to follow our MENTAL model of computing. Fortunately, the mental model of computing can change over time as you become familiar with new paradigms.

The same thing can be said about "which model of computation resemble physical reality." Each of us can have different mental models of physical systems. Personally, the functional paradigm is closer to my mental model than declarative, but imperative still feels the most natural. This isn't a statement about reality, but rather about how you think about it.

I think there is a confusion here: our "mental" grasp of a physical process and intuition is tightly related to how the world works. We develop our intuition from real-world experience. They're not two separate things. This's also why quantum physics is so non-intuitive for us, and why we struggle dealing with it (counter-intuitive it is, we do it anyways, because that's just the way the Nature works --it's not something man-made like Lisp). That being said, the physical processes don't depend on people's understanding. Physics doesn't depend on how you think about the world. The quantum state (or a classical state) is there, and it won't go away just because you want mathematical elegance or try to see things in a different way in your inner world as hard as you can.

That being said, of course it matters the way you write your software. There is a huge gap between actual CPU instructions and Lisp. Between Lisp and the machine is an automated, soft layer of emulation, which may or may not be optimal and is extra work anyway.

There are plenty of ways of accurately representing reality that don't rely on mutable state.

F=MA is a function, and it isn't mutable. I could calculate force from some other function (e.g. Gm1m2/r^2). I can compose those functions together to get a new function. Still nothing mutable. I could continue this to create a model of a physical system that turns into one big function. That function models the system, and it can take some outputs to give whatever outputs you want. All without storing state internally.

So, it's certainly possible to accurately represent physical systems without keeping track of state along the way.

Please tell me you were trolling. Or that you're 10. Otherwise go read some basic mechanics from Goldstein's Classical Mechanics. And learn some basic mathematics.

Classical state of a particle lives in the 2n-dimensional manifold known as phase space. The coordinates of the phase space are the configuration space and the corresponding conjugate momenta. The state is a single point on the phase space, corresponding to the initial conditions of the problem. The Hamiltonian determines the time evolution in the phase space, which is a trajectory.

To make is simpler for you to understand: 1. Position and momentum couples form the physical state. And of course, for any physical system, it exists. 2. You need 2 initial conditions to solve a 2nd order differential equation. You can't solve a differential equation without initial conditions (of course to use this fact, you would need to understand that F=ma is a differential equation, not a function) (Maybe it's better if you read some good introductory text, such as Feynman Lectures on Physics Vol 1, Chapter 9).

If still not clear for you: the initial state in a two body problem is determined by the initial position and velocity. They are the initial conditions of your "function" F=ma, which is actually a second order differential equation. F determines how this initial state will change over time.