evanchooly
03/01/2017, 12:30 PMevanchooly
03/01/2017, 12:30 PMevanchooly
03/01/2017, 12:31 PMorangy
mg6maciej
03/01/2017, 12:53 PMmg6maciej
03/01/2017, 12:57 PMrobin
03/01/2017, 1:32 PMmg6maciej
03/01/2017, 1:44 PMSystem.setProperty
returns previous value and you cannot do that with Kotlin properties.evanchooly
03/01/2017, 1:52 PMevanchooly
03/01/2017, 1:52 PMmg6maciej
03/01/2017, 2:32 PMsetProperty
.evanchooly
03/01/2017, 2:34 PMrobin
03/01/2017, 2:36 PMfun getAndSetFileSeparator(value: String)
to accompany that.mg6maciej
03/01/2017, 2:39 PMevanchooly
03/01/2017, 2:40 PMevanchooly
03/01/2017, 2:40 PMkevinmost
03/01/2017, 4:12 PMsetProperty
returns, and I think using that value hurts readability when you could just use the property's getter before setting it if you really want the previous valueevanchooly
03/01/2017, 4:13 PMmg6maciej
03/01/2017, 4:13 PMevanchooly
03/01/2017, 4:13 PMkevinmost
03/01/2017, 4:14 PMprivate fun systemProperty(key: String) = object : ReadWriteProperty<Any, String?> {
override fun setValue(...) { System.setProperty(key, value) }
override fun getValue(...) = System.getProperty(key)
}
then all of the properties could be, for example:
val classPath by systemProperty("java.class.path")
kevinmost
03/01/2017, 4:14 PMkevinmost
03/01/2017, 4:14 PMmg6maciej
03/01/2017, 4:15 PMkevinmost
03/01/2017, 4:16 PMSystem.{get|set}Property
is straightforward and readableilya.gorbunov
03/01/2017, 4:16 PMevanchooly
03/01/2017, 4:18 PMevanchooly
03/01/2017, 4:18 PMval
is weird given the set there.evanchooly
03/01/2017, 4:19 PMval
fields? vs the userDir
property, e.g., that is mutable