user
10/05/2016, 4:05 PMian_p
10/05/2016, 4:08 PMyole
10/05/2016, 4:08 PMian_p
10/05/2016, 4:08 PMforcelain
10/05/2016, 4:23 PMif (0 <= x && x<= 10)
?yole
10/05/2016, 4:24 PMx in 0..10
forcelain
10/05/2016, 4:24 PMsemoro
10/05/2016, 4:24 PMdpk
10/05/2016, 4:25 PMcoerceIn
as a cool Kotlin featuresemoro
10/05/2016, 4:38 PMkotlin.Number
not describes standard math operators? e.g +
,*
?ean5533
10/05/2016, 4:55 PMean5533
10/05/2016, 4:55 PMNumber
implement all standard math operators, as far as I can tellsemoro
10/05/2016, 5:02 PMByte
, Short
, Int
, Long
semoro
10/05/2016, 5:02 PMilya.gorbunov
10/05/2016, 5:11 PMsemoro
10/05/2016, 5:12 PMNumber
also?ilya.gorbunov
10/05/2016, 5:23 PMNumber
interface does not have the operations, and we couldn't add them there, because on JVM it's represented with java.lang.Number
dmcg
10/05/2016, 8:33 PMilya.gorbunov
10/05/2016, 8:52 PMif your implementation passes an instance of the type it extends (i.e. “this”) as an argument to some other function, it is very likely that you are writing an utility function, not an extension function. If, on the other hand, your implementation calls some function on “this” (like “this.setVisible()” for View), then it is very likely that you use an extension mechanism correctly.
dmcg
10/05/2016, 8:57 PMdmcg
10/05/2016, 9:11 PMhellotimmutton
10/05/2016, 11:11 PMhellotimmutton
10/05/2016, 11:11 PMdwellman
10/06/2016, 1:00 AMdwellman
10/06/2016, 1:00 AMHere JournalJson and AccessType are simple data classes, unencumbered by all the operations that the rest of the system would like them to have; because they can define operations like withOAText() as extension functions when they need them.
dwellman
10/06/2016, 1:02 AMfellshard
10/06/2016, 1:10 AMcypher121
10/06/2016, 3:48 AMList<Pair<K, V>>.toMap()
or Pair<T, T>.toList()
dmcg
10/06/2016, 7:48 AMdmcg
10/06/2016, 7:49 AM