3 ms·
Your project looks really cool, but I’m unconvinced by your take on Turing completeness. It’s a mistake to conflate UI with computability, and a mistake to conf
by dahart 8y ago
Your project looks really cool, but I’m unconvinced by your take on Turing completeness. It’s a mistake to conflate UI with computability, and a mistake to confuse computability with the ability to make programming mistakes or to write bugs.
The academic idea of the halting problem is not to make good UI or save people from themselves or from bugs, it’s just a theoretical math problem, and it doesn’t mean anything useful in practice.
You can write an infinite loop in C, and still hit Ctrl-C to kill it. You can screw up JavaScript and still close the tab. Turing completeness is not a problem in practice. If GIMP’s scripting or plugin environment doesn’t support killing a runaway script, then the bad UI is GIMP, not Turing completeness.
Plus, lack of Turing completeness is no guarantee that a script will be fast and that it won’t be bad UI. The halting guarantee is not a user guarantee on responsiveness or on run time at all.
Lack of Turing completeness might, on the other hand, severely limit real functionality, it might keep users of your language from being able to do cool things. You’re taking at least some kinds of higher level function composition off the table.
Anyway, that said, I will try to check out your project, I’m a big fan of image generation DSLs (having written a couple myself for CG film production) as well as compositing and animation projects.
- Grue3 8y agoI'm not convinced that Turing completeness is needed for real functionality. Can you name a "practical" function that is computable but not primitive recursive? Just because you can theoretically compute Ackermann function doesn't mean it has anything but academic interest.
- dahart 8y agoAre you kidding? All you need for TC is conditional repetition, you don't need recursion. Loops & variables are the two things that make a language Turing complete. Almost everything interesting in the computing world is done using conditional loops. To use your Animstack project as an example, you're not allowing your users to write things like Perlin turbulence (multiple octaves of noise) without a loop, or custom convolutions, or a Mandelbrot fractal, or 2d fluid flow. There are all kinds of practical and fun things you're artificially restricting yourself from. Some of those things can be technically done without TC, but none typically are because it's inconvenient, and because TC doesn't cause any practical problems. Other examples that use Turing completeness in practice: UI event loops (all videogames, all of robotics, all servers of any kind), string replacement, sorting a list of arbitrary size, searching a list of arbitrary size, path tracing renderers, file i/o, regression and any non-linear optimization, I could go on for a very long time, the list is really long. I'd like to know what interesting things you think you can do without conditional loops in a convenient way. Not what's theoretically possible if you bend over backwards, but what's practical and easy. I feel like the list is pretty short. You also didn't answer the question. What is a real problem with TC? Killing runaway programs & infinite loops is not a problem in practice, and therefore neither is preventing people from writing infinite loops. So what's a problem with TC that I should care about? You can never guarantee people won't make mistakes, unless you make all their decisions for them. That's what non-TC languages normally feel like; a recipe book for pre-decided outcomes, not very powerful, not very interesting. Nor did you address the fact that a decidable non-TC language doesn't guarantee halting in any reasonable amount of time. So how is it actually helping you to prevent TC? It doesn't seem like it is. Here's a question- how many conditional loops did you use in the implementation of Animstack, under the hood?
- Grue3 8y ago>Other examples that use Turing completeness in practice: UI event loops (all videogames, all of robotics, all servers of any kind), string replacement, sorting a list of arbitrary size, searching a list of arbitrary size, path tracing renderers, file i/o, regression and any non-linear optimization, I could go on for a very long time, the list is really long. A lot of these don't require Turing completeness. Anything that can be given runtime guarantee that's O(n^k) or even O(e^n) can be implemented without Turing completeness. Now if you need O(Ackerman-function) runtime, you gotta bring out the Turing machine, but I don't think such algorithms exist in practice. Consider that pure SQL is not Turing complete. You can "search lists of arbitrary size" in it. And you can construct pretty complex queries in it to do so. It's the most popular programming language around and most people don't use the parts that make it Turing complete. >Almost everything interesting in the computing world is done using conditional loops. There's almost nothing that requires conditional loops with arbitrary conditions. Loops in Python all have the form "for element in sequence" and you can go pretty far without using custom iterators that allow for infinite sequences, which is considered an advanced topic. A lot of people program in non-Turing complete subset of Python! > how many conditional loops did you use in the implementation of Animstack, under the hood? I actually can answer this easily. It's implemented in TinyScheme (the scripting language of GIMP) which doesn't have loops, only recursion. So technically zero. Scheme is Turing-complete of course, but I don't think it has to be to implement Animstack.
- dahart 8y agoRecursion is looping, so technically not zero, right? There’s a lot of ignoring practice in your response. Python, C, O(n^k) algorithms, all of it is implemented with Turing Complete languages, whether it’s technically required or not. I don’t know the non-TC subset of Python you’re talking about, nor how many people are using it. Are they using it specifically to limit themselves to less powerful constructs, or for other reasons? The web says SQL is in fact TC contrary to your claim. https://stackoverflow.com/questions/900055/is-sql-or-even-tsql-turing-complete https://stackoverflow.com/questions/900055/is-sql-or-even-ts... > There's almost nothing that requires conditional loops with arbitrary conditions. The entire stack of tech you are using to type that sentence and send it over to Hacker news runs on intentionally infinite loops. The input element, the js in your browser, the event loop in your browser, your NIC and WiFi box, all the routers between you and HN, the web server responding to news.ycombinator.com. GIMP has an infinite loop waiting for user commands to launch your Animstack scripts. My professional field is graphics, which is why I mentioned path tracing, and path tracing requires loops with arbitrary conditions, as do many statistical simulations. How would you write a non-TC memory manager? I don’t really know what you have in mind when you say almost nothing requires conditional loops, but I don’t see a lot of evidence of that being true. All video games run on while(1) loops. You still didn’t answer my questions, so maybe this is as far as we need to go. Why does TC matter at all when you can kill a script? What is preventing TC buying your language when the programs are bug free? What is non-TC buying you when non-TC programs can take aribtrary amounts of time? Why is restricting the power of a language desirable? I havent seen a single reason yet that I buy.