logoalt Hacker News

Comptime – C# meta-programming with compile-time code generation and evaluation

70 pointsby bj-rnlast Saturday at 8:49 PM14 commentsview on HN

Comments

smcnctoday at 2:30 AM

I think Zig really shines here: https://ziglang.org/documentation/master/#comptime

show 2 replies
CharlieDigitaltoday at 12:04 AM

C# meta programming game is strong. Source generators are :chefs_kiss:

show 1 reply
mfroyesterday at 11:58 PM

This seems like the kind of feature that should be built into MSBuild.

show 1 reply
mgaunardtoday at 12:03 AM

So it's like C++ consteval?

jauntywundrkindtoday at 3:12 AM

Makes me think of Boo language; Boo was so good at metaprogramming and multi-phasr programming! A very fine .NET language that was so far ahead of the curve, with having the tools of that language be usable at runtime.

Alas many of the docs are offline now. But it had great quasiquotes, which let you write code that gets turned into AST that you can then process. Good macros. A programmable compiler pipeline. So much. Alas, obscured now. https://boo-language.github.io/

show 1 reply