Comment by OSaMaBiNLoGiN

5 days ago

All the changes look great. But I don't know how I feel about the syntax. A lot of things that very well could be first-class just aren't. Instead of a `lazy` keyword, we get `LazyConstant<T>`.

I'm sure there's reasons as to why. I just don't know them.

It‘s easier to evolve library code. If Java would ever infer type of constants from initializer (makes more sense than a new keyword), it could look nice and powerful:

   private final LOG = lazy(logger(MyThing.class));

Because library code is easier to maintain and for people to understand.

And plus if you add a new keyword someone else will complain about complexity of keywords.

Once introduced, keywords and Java syntax is nearly impossible to change or to remove. If it's possible to get the job done using a class, perhaps with some JVM magic, it's not wise to whip out new syntax.