5 ms·
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` k
by OSaMaBiNLoGiN 6mo 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.
- ivan_gammel 6mo agoIt‘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));
- vips7L 6mo agoBecause 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.
- samus 6mo agoOnce 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.