Skip to content

Instantly share code, notes, and snippets.

@pawegio
Last active February 3, 2017 12:56
Show Gist options
  • Save pawegio/30e4dc39179f148fd507b4f2f67aecc1 to your computer and use it in GitHub Desktop.
Save pawegio/30e4dc39179f148fd507b4f2f67aecc1 to your computer and use it in GitHub Desktop.
inline val <reified T> T.tag
get() = T::class.simpleName
fun Any.log(msg: String) = Log.d(tag, msg)
@tfcporciuncula
Copy link

Are you using reified just to show that now, since you can inline properties, you can use reified in those situations?

I'm just wondering if there's any advantage when comparing to this simpler approach:

val Any.tag: String
  inline get() = javaClass.simpleName

@pawegio
Copy link
Author

pawegio commented Feb 3, 2017

You're right. I updated gist to actually use reified type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment