5 ms·
Oh that's a great response, much appreciated. I'm glad I asked the question. From what I understand, a disadvantage of this templating capability in C++ is tha
by lioeters 2y ago
Oh that's a great response, much appreciated. I'm glad I asked the question.
From what I understand, a disadvantage of this templating capability in C++ is that it makes the language "unpredictable" in terms of static analysis, so that, for example, intellisense in code editors cannot be implemented without having a full C++ compiler. ..But then again, maybe that's true of any language with macros, where the code can dynamically modify itself.
That's an interesting point too, about how C++ templating is a second language that runs at compile time, making the code more complicated to understand. Whereas in Lisps, macros are written in the same language, working with the same AST in a unified way. It's conceptually simpler, a more elegant way to achieve the same result.
I'd heard of comptime in Zig, but didn't know that there was a "complexity limit". Fascinating. It makes sense how it's related to the concept of "gas" in the Ethereum virtual machine, and "fuel" in Piccolo. (I remember seeing the latter language recently.)
https://ziglang.org/documentation/master/#setEvalBranchQuota https://ziglang.org/documentation/master/#setEvalBranchQuota
https://kyju.org/blog/piccolo-a-stackless-lua-interpreter/#fuel-pacing-and-custom-scheduling https://kyju.org/blog/piccolo-a-stackless-lua-interpreter/#f...
https://ethereum.org/en/developers/docs/gas/ https://ethereum.org/en/developers/docs/gas/
..Whew, many tempting rabbit holes there. :) I'd been interested in Zig, reading about it here and there, but your comment convinced me to get more serious about studying it. Thanks!