https://kotlinlang.org logo
s

stantronic

11/20/2019, 10:47 AM
My syntax suggestion for that -
Copy code
private val users = MutableLiveData(0)
  exposeas LiveData<User>
3
e

elect

11/20/2019, 10:50 AM
maybe
exposeAs
s

stantronic

11/20/2019, 10:52 AM
I was thinking that, but seems the convention is to keep keywords all lower case, even when composed of two words e.g. - lateinit, typealias etc.
e

elect

11/20/2019, 10:52 AM
right..
s

stantronic

11/20/2019, 10:53 AM
also just realised that would need to think through how to handle protected status
e

elect

11/20/2019, 10:54 AM
? I'd say the modifiers is declared after
exposeas
, in your case is implicitely
public
s

stantronic

11/20/2019, 11:00 AM
that’s one option. Theoretically could get really complex and have different types for private, protected, internal and public, each being more restrictive.
Copy code
private val something = RawType()
  exposeas protected MoreRestrictiveInteface
  exposeas internal EvenMoreRestrictiveInterface
  exposeas MostRestrictiveInterface
👍 1
2 Views