logoalt Hacker News

OSaMaBiNLoGiNyesterday at 10:47 PM3 repliesview on HN

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.


Replies

vips7Ltoday at 5:53 AM

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.

ivan_gammelyesterday at 11:50 PM

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));
samustoday at 6:41 AM

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.