Comment

Comment by lazulicurio

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.
parent lazulicurio 3 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton