Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You should look into Jai’s metaprogramming features, which are ahead of everything else out there. Zig is really the only language exploring some of the same concepts with comptime, but doesn’t even come close.
 help



Yeah I wrote some metaprogramming stuff, but to me it felt like run a python script and use python AST to manip the program. Its basically just a program that runs and has hooks into the compiler steps and the code.

This left me feeling like "I wish I had decorators and annotations" from other languages, not a way to write arbitrary compile-time code. The use case for that is so rare, and kludgy, that I don't think its worth it.

Now it did shine with basic hygenic macros, which felt useful and solid. Its basically how C macros should have been done originally (a function that emits code at compile time). However conventions like $Code where a bit jank imo, again felt like using someone's home-spun scripting language, rather than a well thought out solid design, versus something like Rust's Syn.

I know Jon Blow hates "design by committee", as he is so much smarter than others, but honestly a lot of this felt like listening to any sane reviewers would catch this stuff. I mean really basic stuff like #cast which reads like a compile-time macro/pragma, but its actually a runtime cast? Or mixing casing conventions, underscores or not, etc. Names of modules are all over the place, it just feels like one dude trying to make a half-baked lang over a long period while being distracted doing 20 other things.


What can i do in Jai i cant in, say Zig? I have never use Jai so im curious. I really how Haxe does metaprogramming, its incredibly powerfull. But not sure how Jai compares.

In Haxe i can pretty much do anything, run code, generate code, i even built an openapi doc on compile time just from types.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: