jwstegemann / fritz2

Easily build reactive web-apps in Kotlin based on flows and coroutines.
https://www.fritz2.dev
MIT License
627 stars 25 forks source link

Rename `classes` utility function to `joinClassNames` in order to reduce naming confusion #828

Closed Lysander closed 2 months ago

Lysander commented 6 months ago

The classes-utility function just joins arbitrary Strings with classnames to one String. It takes care of adding aprropriate spaces and drops null values.

The name was meant to be short, but as it seems quite often it competes with some parameter named also classes, which is just passed through from higher call sites. This reads not nicely:

classes(classes, "... some local added classes", ...)

It might be better to add some suffix to express its functionality: Joining of different pieces of classnames, though joinClassNames or joinClasses?

joinClassNames(classes, "... some local added classes", ...)

We could mark the current function with @Deprecated("renamed to ``joinClassNames()``", ReplaceWith("joinClassNames(classes)")) in order to enable a smoother transition.

haukesomm commented 6 months ago

I would lean towards joinClasses as the shorter name seems more practical to me, especially since the classes function is used rather frequently.