Hacker News new | ask | show | jobs
by lazulicurio 1207 days ago
It's a tad more verbose, but I assume the simplest way would just be to use a standard closure.

    void log(Supplier<? extends String> messageSupplier);

    log(() -> log.info"User is \{someExpensiveFunction(user)}");
The pattern of using Supplier to provide a lazy argument is pretty well-established afaict.