3 ms·
There's not really a nice way of implementing the syntax without changing the language. Although perhaps they could resolve this with magic imports? impor
by yarg 4y ago
There's not really a nice way of implementing the syntax without changing the language.
Although perhaps they could resolve this with magic imports?
import java.lang.magic.optional;
public class Foo{
public static void main(String...args){
Foo? f = ...;
if(f){
f.doThings();
}
f.doThings(); //compile time error
}
}
The idea being that importing the magic class enables the cleaner syntax.
- usrusr 4y agoI doubt that it's possible to open the door for "language version by imports" without turning that decision into a forever-floodgate. Note that I am not entirely sure that it would be a bad decision (I do lean in that direction however), but it would definitely be a severe one. It would be like a variant of inviting Dracula across the doorposts, only that this one may or may not actually be a cool guy and not a vampire, but in any case he will sure bring all his friends, and their friends and so on forever.
- yarg 4y agoWith great power comes great responsibility.