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

I think you're thinking about it too much.

   log.info(() -> STR."template \{here}");


The question was whether string templates will support laziness, not whether whatever the string template is eventually used for supports laziness. String templates supporting laziness would make you independent from what the point-of-use supports.


I think that's the wrong question. String templates don't need to support laziness. It's a well established pattern in Java that laziness is done via Supplier's and it directly solves op's question about logging where the level isn't enabled. This is exactly how logback and other logging implementations handle it now.




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

Search: