shiraji
12/11/2017, 1:52 AMstatic import
?benleggiero
12/11/2017, 1:55 AMbenleggiero
12/11/2017, 1:58 AMPoint
class with (x,y) coordinates, and some Size
class with width x height dimensions.
With the current system, this won't compile:
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 typeshiraji
12/11/2017, 2:09 AMYou still have to know where to look to find those still-global constantsIf the IDE suggests those constants, will it solve the problem?
gildor
12/11/2017, 3:22 AMimport me.ben.Size.zero as szero
gildor
12/11/2017, 3:23 AMzero
constant for me when you just write z
or if you open autocomplete window I see zero right after Point
constructorgildor
12/11/2017, 3:36 AMYou 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
shiraji
12/11/2017, 5:53 AMIdea already does this. Also, smart autocomplete allows to get only valid suggestionsAh! This is what I wanted to say! Thanks 😊