4 ms·
That compile-time concept is great. I've wanted C++ to have something like that for a long time. The only problem is that there is no way to debug this compile-
by mikulas_florek 10y ago
That compile-time concept is great. I've wanted C++ to have something like that for a long time. The only problem is that there is no way to debug this compile-time code the same way one can debug run-time code. If there is an error, it produces static message which is hard to understand in more complicated stuff. You can see this in complicated C++ templates.
- dom96 10y agoI'm not sure about Zig, but in Nim compile-time code produces a stack trace just like run-time code. But perhaps you are talking about debugging using a debugger like GDB? That is indeed not supported. But using a simple `print` statement is enough in most cases for debugging.
- quelltext 10y agoIt shouldn't be too hard to incoroprate the debugging of compile time computation.
- mikulas_florek 10y agoIndeed, yet nobody does that.
- jokr004 10y agoYeah he's definitely talking about a full fledged debugger like GDB. For the most part yeah, some print statements will get the job done, but that's a serious pain in the ass if you've got a ton of variables that you need to look at. Significantly simpler to just be able to look at everything at once. Also, I'm unfamiliar with Zig, but is it even possible to print anything from your code during compilation? Seems like you wouldn't be able to do that.
- billsix 10y agoIn libbug you can do anything at compile time. Open and write to files, run a test suite, anything. http://billsix.github.io/cac.html http://billsix.github.io/cac.html
- jokr004 10y agoVery cool!
- mikulas_florek 10y agoYes, I was talking about full-fledged debugger. Even VC++ quite often prints the whole stack when there is an error in template code, but the messages can be tens of lines long, and sometimes do not contain all the necessary information. This and long compile times are the reason why many people tend to avoid templates and template metaprogramming.