Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Kotlin string templates or string formatting arguments? #395

Open
erikhuizinga opened this issue Jul 13, 2020 · 0 comments
Open

Use Kotlin string templates or string formatting arguments? #395

erikhuizinga opened this issue Jul 13, 2020 · 0 comments

Comments

@erikhuizinga
Copy link
Contributor

Kotlin has string templates, e.g. "Hello, $person!" where person can be some string. I wonder: how does such a string with template perform when passed to Timber, compared to a string formatted with arguments like so: Timber.v("Hello, %s!", person)? Is there a noticeable/significant difference between the two?

Therefore, should Timber's lint rules warn about string template usage?
Or on the contrary, should strings with formatting arguments in Kotlin files result in a warning that they can or should be replaced with templates?

Another thing to consider is a mention in the Timber docs about this: which of the two methods is preferable?

Kotlin string templates are an idiomatic language feature and may therefore be preferable. I'm unaware of the underlying compile-time/runtime details of string templates, which may be different per Kotlin platform.

This is related to a few other issues where Timber-Kotlin interop is discussed.

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

No branches or pull requests

1 participant