I hope the term "deyodawgification" enters the pantheon of elegant code purification terms of art, alongside the classics like "degotofying", "deCOMtamination", and "outparamdelling".<p><a href="https://knowyourmeme.com/memes/xzibit-yo-dawg" rel="nofollow">https://knowyourmeme.com/memes/xzibit-yo-dawg</a><p><a href="https://wiki.mozilla.org/Gecko:DeCOMtamination_Algorithm" rel="nofollow">https://wiki.mozilla.org/Gecko:DeCOMtamination_Algorithm</a><p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=455943" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=455943</a><p><a href="https://news.ycombinator.com/item?id=22708241">https://news.ycombinator.com/item?id=22708241</a><p>Who knows (or can invent) any other good ones:<p>Deadlocksmithing, JSONcology, YAMLectomy, XMLimination, DeDTDification, DeXMLEntitification, ExCDATAration, AntiPOJOification, SOAPerfluousness Scrubbing, WSDLectomy, Delogorrhea, DeK8ification, HelmholtzianRechartification, DevOpsDevangelicalism, FactoryFactoryDefactoringDefactoring, Antiquasimonolithicmicrofragmentedmacrodecontainerizationarianism...
I'm interested in examining the idea of a programming language that eschews the notion of a callstack and returns to having a single fixed activation record per function. This obviously places a lot of limits on language design, but in return you get a statically-guaranteed upper bound on memory usage, plus weirdo stuff like the ability to hand out references to local data in functions that have already returned (which remains valid as long as you don't call the function again, which I think should be possible to enforce via a borrow checker).
This is a neat bug!<p>A colleague and I spent some time last year looking for DoS vulnerabilities caused by recursing on user input [1].<p>TL;DR: With CodeQL and some manual review, we found several issues resulting in two assigned CVEs, a rustsec advisory, and a handful of fixes implemented in various projects.<p>We mostly looked at Java projects. It is interesting to see a C vulnerability from around the same time.<p>It would be cool to see a larger study on how common this issue is across different programming languages.<p>[1]: <a href="https://resources.trailofbits.com/input-driven-recursion-white-paper" rel="nofollow">https://resources.trailofbits.com/input-driven-recursion-whi...</a>
Stack Clashing is pretty neat, something you should really pay attention to in embedded spaces (its often exploitable in UEFI land as most EDK2 builds lack guard pages).<p>I got to write some exploits for some recently, very fun bug class to exploit.
There's a useful clang-tidy function to warn on this, for when you want to ensure there is no recursion lurking anywhere in a large codebase sensitive to stack overflow issues:<p><a href="https://clang.llvm.org/extra/clang-tidy/checks/misc/no-recursion.html" rel="nofollow">https://clang.llvm.org/extra/clang-tidy/checks/misc/no-recur...</a>
There's a wonderful DDJ interview with James Clark (author of expat and developer many other open source sgml and xml standards and tools like Relax/NG, and even horrible ones like XSLT ;) called "A Triumph of Simplicity: James Clark on Markup Languages and XML", in which he explains how a standard has failed if everyone just uses the reference implementation, because the point of a standard is to be crisp and simple enough that many different implementations can interoperate perfectly.<p>A Triumph of Simplicity: James Clark on Markup Languages and XML:<p><a href="https://www.drdobbs.com/a-triumph-of-simplicity-james-clark-on-m/184404686" rel="nofollow">https://www.drdobbs.com/a-triumph-of-simplicity-james-clark-...</a><p>I wrote more about his work in this discussion thread about Ted Nelson on What Modern Programmers Can Learn from the Past, and reading documents from 20 years ago:<p><a href="https://news.ycombinator.com/item?id=16226209">https://news.ycombinator.com/item?id=16226209</a><p>>Reading documents from 20 years ago is a mixed bag. Links usually fail horribly, which was something Xanadu was trying to solve, but I'm not convinced they could have solved it so well that 20-year-old links would still actually work in practice. [...]<p>>In the ideal world we would all be using s-expressions and Lisp, but now XML and JSON fill the need of language-independent data formats.
>Not trying to defend XSLT (which I find to be a mixed bag), but you're aware that it's precursor was DSSSL (Scheme), with pretty much a one-to-one correspondence of language constructs and symbol names, aren't you?<p>>The mighty programmer James Clark wrote the de-facto reference SGML parser and DSSSL implementation, was technical lead of the XML working group, and also helped design and implement XSLT and XPath (not to mention expat, Trex / RELAX NG, etc)! It was totally flexible and incredibly powerful, but massively complicated, and you had to know scheme, which blew a lot of people's minds. But the major factor that killed SGML and DSSSL was the emergence of HTML, XML and XSLT, which were orders of magnitude simpler.<p>James Clark:<p><a href="http://www.jclark.com/" rel="nofollow">http://www.jclark.com/</a><p><a href="https://en.wikipedia.org/wiki/James_Clark_(programmer)" rel="nofollow">https://en.wikipedia.org/wiki/James_Clark_(programmer)</a>
Explicit recursion is as harmful as goto. We already <i>have</i> a solution - they're called recursion schemes[1].<p>Using recursion schemes is analogous to using structured programming rather than just constructing loops and branches out of gotos. The problem is the functional programming community got there first and the names are the equivalent of FactoryFactoryFactory and going to be a turn off to normal programmers even though the concepts are dead simple.<p>1. No citation because linking to a blog post containing Haskell is proving my point.
> Please leave recursion to math and keep it out of (in particular C) software: it kills and will kill again.<p>This is just nonsense. The issue is doing an unbounded amount of resource consuming work. Don't do an unbounded amount of resource consuming work, regardless of whether that work is expressed in a recursive or iterative form.<p>Any recursive function can be transformed into a tail recursive form, exchanging stack allocation for heap allocation. And any tail recursive program can be transformed into a loop (a trampoline). It's really not the language construct that is the issue here.
Yet another article linking to the '10 rules of safety critical development' as a way to bash recursion.<p>If you're going to cite this, at least make sure you're not allocating any memory after startup.
How awful. Did anyone call The Recurse Center?<p><a href="https://news.ycombinator.com/item?id=43361773">https://news.ycombinator.com/item?id=43361773</a>
<a href="https://en.wikipedia.org/wiki/Tragedy_of_the_commons" rel="nofollow">https://en.wikipedia.org/wiki/Tragedy_of_the_commons</a><p>It's crazy how most companies just mindlessly fish in the commons and cannot even respond to whoever produces the common good.<p>Shoutouts to the 2 companies that responded by sharing resources (money or engineer time) when asked to.<p>Shame that the other 40 companies basically get to enjoy the benefits while playing the clueless fool.<p>Hopefully these 2 companies find a competitive advantage in being supply chain aware. No sympathy to the rest of the companies if they get hacked.<p>EDIT: <a href="https://en.wikipedia.org/wiki/Free-rider_problem" rel="nofollow">https://en.wikipedia.org/wiki/Free-rider_problem</a><p>This seems like a much more specific name for the problem
It is silly to make an overly broad statement about recursion killing. On modern "hosted" OSes, there are safeguards about stack overflows, which will quickly kill your process. This _can_ be a problem on embedded systems with limited memory management facilities (e.g., hw with no MMUs) and I do understand that the library author can't control where the library is used, and in fact some safety critical systems require a maximum stack depth guarantee which rules out recursion. However, some problems, especially parsing CFGs, are inherently recursive in nature and I'd argue going the non-recursive route with explicit stacks would result in bugs elsewhere because the code becomes hard to reason about.
I would argue that the title is misleading and overly alarmist here. This particular bug may have involved recursion and a stack overflow, but that's like saying "malloc kills" in the title of an article about a heap overflow bug. The existence of stack overflow bugs does not imply that recursion is bad any more than the existence of heap overflow bugs implies that malloc is bad. Recursion and malloc are tools that both have pretty well understood resource limitations, and one must take those limitations into account when employing those tools.
<i>Please leave recursion to math and keep it out of (in particular C) software: it kills and will kill again.</i><p>Is the whole (tail-recursion optimized) Lisp language family subject to DOS? Just check that you terminate at some point, right? "Recursion kills" is just too broad and not helpful.
I think the hate on recursion is too strong. For one thing, some languages have tail call optimization, which can turn recursion into a loop without using up the stack. For another, recursion can be bounded, so that if a malicious document tries to use a lot of recursion, it just results in an error reporting the recursion was too deep.
I don’t understand the obsession of people with recursion. Sure it’s a cute math trick, it makes you feel smart, but it is an undebuggable mess with a ton of gotchas that lead to stack overflows.<p>Let the math to the math guys who never ship a product.