4 ms·
The blog post is flat out wrong makes some huge, errant assumptions. To create hardware that implements the same behavior as this program, you would need: a d
by oso2k 12y ago
The blog post is flat out wrong makes some huge, errant assumptions.
To create hardware that implements the same behavior as this program, you would need:
a dynamic memory allocator
Wrong.
a virtual memory system (or dozens of gigabytes of RAM, just in case)
Why would this problem need a VM?
and a very complex Finite State Machine to implement the behavior of all the methods that are called directly and indirectly (so this includes methods from "list", "reverse_iterator", "allocator", etc.).
Again, wrong.
If the problem is to do
We'll make the assumption that there exists a system than can transform any simple program written in a general-purpose programming language to an efficient hardware implementation. This means that if I write a simple program, for example one that creates a list of random numbers and outputs them in reverse order
That is not a very hard problem and one could very well write a compiler that does that efficiently on FPGA or otherwise. Heck even designing a circuit would be doable for many EE BS grads.
In general, I believe the author attacked the proof wrong. The things he believes are necessary (malloc, VM, FSM) are inventions to circumvent hardware limitation, not language expressiveness or other issue with the general purpose language. Humans invented programming languages not because the hardware is impossible to create, but because it is impossible for most wetware (humans) to create that hardware (and/or software).
- kd0amg 12y agoMore broadly, it's important to distinguish what things are aspects of the actual program semantics and what things are just common implementation strategies. Linking in lots of STL implementation code is not strictly necessary to get the behavior of a structure where one can push_back and walk over with an iterator. A similar argument to the article's would say that a compiler for a language with first-class functions cannot target a system with memory protection. That said, most general-purpose languages are designed with the expectation that they'll be implemented on a conventional target machine. Compiling something like C++ to efficient hardware is probably far into "sufficiently smart compiler" territory. So I'm inclined to believe the conclusion even if the proof is faulty.
- oso2k 12y agoI'd almost buy your conclusion if C to HDL/Verilog compilers didn't exist [1]. [1] http://en.wikipedia.org/wiki/C_to_HDL http://en.wikipedia.org/wiki/C_to_HDL