in reply to Re^2: If I was forced to use only one kind of loop for the rest of my days it would be a
in thread If I was forced to use only one kind of loop for the rest of my days it would be a
Who cares about Turing completeness? You're running on a machine with a finite number of states; so a DFA language is all you can really implement in real life. Turing complete languages can't be implemented; just approximated.
I could attack this statement from the theocretical side. Computer hardware is developping in a very fast pace. Let's imagine you have a system where the state of the program can be saved and reloaded on a machine with more memory, or one that runs on a transparent cluster of machines where new nodes can be added dynamically and old nodes discarded. Such a system could run forever, if you keep updating it with new hardware. While my lifetime or the lifetime of the computer I'm typing on right now is certainly finite, such an advanced system could live forever, if the civilisation doesn't end in some catastrophe. (In fact, Paul Davies argues in his book The Last Three Minutes that a super-entity could do an infinite number of calculations, and discusses this in the two cases of whether the Universe will expand forever and end in a Big Chill, or gravitation will win and the Universe will end in a Big Crunch.)
However, even if a DFA is all you can implement in the real-world (there are some steps between the DFA and a Turing machine in power of course), I am a mathematician, and I'd like to at least imagine that I have a Turing-complete machine. I use it even if it's only a theocretical construction. I am not an engineer, who uses a ruler to draw straight line, and uses large plastic templates to be able to draw any kind of ellipse. I just draw a bumpy line or a potato by hand, and say it's a straight line (moreover, an infinitely extending straight line that has no width or thickness) or an ellipse. This is a very pleasant, almost god-like state, because I can create objects engineers can't even dream of just by the power of my mind.
Naturally, this is not the real reason I wouldn't rely on foreach loops. The reason is simply that they're often difficult to use. It's not easy to convert while loops to foreach loops. It's even more difficult to do it if you care about efficency (because I don't just have any DFA, but a DFA with a limited number of states and limited speed of execution). Foreach loops require to use side-effects even if I don't want to, and you could easily avoid it with do loops. Foreach loops come in different versions in each programming language. But the deciding reason is that C doesn't have a foreach loops, so if I decided on foreach, I couldn't use C anymore.
Update: "it's silly to stop with a Turing-machine" -- you're right with this part. "Why not use a bigger field(?) than the integers" -- indeed, why not: Symbolic calculations with operator overload, Re^3: Illegal Modulus zero.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: If I was forced to use only one kind of loop for the rest of my days it would be a
by Anonymous Monk on Oct 05, 2005 at 17:40 UTC |