Skip to main content
5 events
when toggle format what by license comment
May 3 at 4:24 comment added ggZQX6YPvD The problem with the complexity causing it to not be finished by the heat death of the universe could be addressed by simply rejecting all programs that take too long to compile. This would not involve crunching through to the heat death of the universe. However, that might impede on the usability and expressiveness of the language, and also if a user didn't understand the workings of the compiler, they might be left wondering why their perfectly correct program with no errors was completely rejected. The program wouldn't nessesarially look anywhere near as long as it could expand to.
May 3 at 4:01 comment added ggZQX6YPvD If having sane performance were to not matter (it does matter), all of those impossible features are theoretically possible if the language is turing complete; however, some of them may explode code size while defeating the whole purpose of the inlining in the first place. Precompiled libraries could be inlined if inline assembly is allowed. However, a compiler almost certainly cannot optimize the inline assembly, and inline assembly can turn many variables volatile, which could hurt performance. Function pointers could be turned into enormous switch statements with many function calls, etc.
May 3 at 3:43 comment added ggZQX6YPvD Actually, any recursive function can theoretically be rewritten as one using a loop and a stack. This isn't very difficult when a function is only recursive with itself. However, it often hurts performance, as extra memory must be allocated for a stack unless the function is tail-recursive. Conversion to loops would help performance for tail recursive functions. However, unless the compiler has sufficient loop optimizations, the conversion to loops would defeat much of the purpose of inlining the function.
May 3 at 2:50 vote accept ggZQX6YPvD
May 3 at 1:49 history answered Nate Eldredge CC BY-SA 4.0