Prep: Golang Comptime
github.com
github.com
There are some other interesting repos from the same author, namely https://github.com/pijng/goinject, which lets you inject code as part of preprocessing. Feels a lot like Java’s annotation magic.
Thanks for sharing. I wasn’t even aware Go had pre-processors, or that modifying the AST like that is even possible.
I think this kind of code gen is very wonky, and hard to debug unless there is some official API support for it. Using a sufficiently advanced build tool to handle this in a separate build step would help as well. But that usually causes problems with IDE support.
Bugs in those systems are hell to trace.
Coming to the Go world of “if you’re gonna do code generation, write a dumb program that generates source code text, run it and check the result into source control” was a revelation - yeah, it’s ugly, but guess what? It can be debugged by human beings.
So there's a lot that is different with Jai, it's more like a highly anticipated game than a language.
Yes, I guess. I wouldn't be surprised to see "Jai inspired" languages coming out before Jai itself, since some of the ideas look pretty good.
> How does one even get the compiler and build programs ?
Don't know how seriously you're asking this, but I believe you can apply to use it and if Jon likes your credentials and what you want to try it on he might let you have the compiler for some version. Don't know why he won't just open source it and say it's a early version passive of change, but game development is not usually very open source friendly compared to web dev.
I'm somewhat surprised by how little I see online about it.
If there were language support for this sort of thing, it could track the dependencies itself.
(and by "looking at" I mean "kept meaning to try it but totally haven't got round to it yet" but I still think it's worth a look)
* integrated into bazel rather than go-compiler-hacking * your "normal" code just imports the result - which can be go-to-definition-ed to see the generated code
That is nice. Makes coding and build flow simple, clean and easier to maintain.
Just say no, kids. Life will be better.
I had a similar idea a few months ago about whether it's possible to achieve some form of comptime with TypeScript. I didn't get too far unfortunately, but I think the implementation would need to interact with the TypeScript compiler API in some way.