3 ms·
> Efficient String interpolation is hard without macros Not quite. It is hard without some compile-time computation, but what's compile-time for languages rely
by pron 4y ago
> Efficient String interpolation is hard without macros
Not quite. It is hard without some compile-time computation, but what's compile-time for languages relying on AOT compilation (and requires macros or compile-time introspection as in Zig), happens at runtime in Java because that's when the optimising compilation happens, and Java has a user-exposed mechanism for defining call-sites (https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/invoke/CallSite.html https://docs.oracle.com/en/java/javase/19/docs/api/java.base...). It's just that, as with most of our new features, we expose a simple API first and a sophisticated API later. No need for macros.