What is the differences between this and `static i...
# language-proposals
s
What is the differences between this and
static import
?
🧵 1
b
You still have to know where to look to find those still-global constants
Also, say I have some
Point
class with (x,y) coordinates, and some
Size
class with width x height dimensions. With the current system, this won't compile:
Copy code
import me.ben.Point
import me.ben.Point.zero // represents the (0,0) coordinate
import me.ben.Size
import me.ben.Size.zero // represents the 0 x 0 size

fun takePoint(point: Point) {}

takePoint(zero) // Cannot tell if you want to use the Point or the Size constant
But with implicit member expressions, the type would be clearly inferred from the function's parameter's type
s
You still have to know where to look to find those still-global constants
If the IDE suggests those constants, will it solve the problem?
g
Also small workaround about Point/Size zero conflict you can use import alias:
import me.ben.Size.zero as szero
Idea suggests
zero
constant for me when you just write
z
or if you open autocomplete window I see zero right after
Point
constructor
You still have to know where to look to find those still-global constants
If the IDE suggests those constants, will it solve the problem?
Idea already does this. Also, smart autocomplete allows to get only valid suggestions
s
Idea already does this. Also, smart autocomplete allows to get only valid suggestions
Ah! This is what I wanted to say! Thanks 😊