Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Keywords order #45

Open
xsveda opened this issue Dec 6, 2017 · 3 comments
Open

Keywords order #45

xsveda opened this issue Dec 6, 2017 · 3 comments

Comments

@xsveda
Copy link

xsveda commented Dec 6, 2017

Properties and functions may often have more keywords which order is not strictly ordered in Kotlin but may be confusing. Few examples:

lateinit on properties:

  • private lateinit var foo: Foo - OK
  • lateinit private var foo: Foo - WRONG, breaks the relation between lateinit and var, the visibility modifier is kind of optinal (when public)

abstract on functions:

  • protected abstract fun foo() - OK
  • abstract protected fun foo() - WRONG

open/final on properties and functions:

  • open protected val foo: Foo - seems better to me
  • protected open val foo: Foo
  • final override fun foo() - seems better to me
  • override final fun foo()

Do you think such rules might be valuable in the Style Guide?

@JakeWharton
Copy link
Contributor

I do, but it's not our place to decide what that order is. Has JetBrains officially defined this yet? I know there's been discussion about it but I haven't seen anything final.

@xsveda
Copy link
Author

xsveda commented Dec 7, 2017

Me neither, thank you for the link to the discussion. So let's wait for its outcome...

@JakeWharton
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants