I want a language where I can "zoom in" on any expression and provide a custom implementation using a lower-level language (and zoom in on expressions in that language, and so on, all the way down to asm). Practical? Perhaps not. But it sounds super fun.
-
Show this thread
-
Thinking about this more: "zoom in" would actually mean running the compiler on some highlighted section of code, expanding it into the lower-level code that the compiler would normally generate (but wrapped in an "asm" block, or equivalent)
1 reply 0 retweets 0 likesShow this thread -
An inescapable downside of such a language would be that it would severely limit the compiler's ability to do whole-program optimization. E.g. you might think you're helping by writing inline asm, but actually the compiler could have proven that that block was unreachable anyway.
1 reply 0 retweets 0 likesShow this thread -
So it's certainly possible that such a language would typically result in slower programs. Compilers work best when given full reign with total context, and this language deprives them of that.
1 reply 0 retweets 0 likesShow this thread -
However, compilers fail in one important respect: they can't read the programmer's mind and discern their *intent*, which often leads to "fighting the compiler." Ideally this language would have none of that. The compiler would be like your lab assistant, not your boss.
1 reply 0 retweets 0 likesShow this thread -
Here's a fun thought: junior programmer writes a high-level version of a function, which works fine but runs slowly. Then they pass it on to the senior programmer, who compiles it to a lower-level language and hand-optimizes the generated code.
1 reply 1 retweet 0 likesShow this thread -
(Then, they pass it to the greybeard, who compiles the low-level language to asm and hand-optimizes it into some Story-of-Mel-esque monstrosity.
)1 reply 0 retweets 1 likeShow this thread
But the cool thing is that all of these versions are interchangeable. If the greybeard introduced a bug, you can "rollback" to the senior version while you debug. Good tooling could make this painless.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.