Now that Jetpack Compose is in Beta and I get lint...
# compose
j
Now that Jetpack Compose is in Beta and I get lint errors about `Composable functions that return Unit should start with an uppercase letter`I am slowly starting to realize, after months of denial, the battle for lowercase + camelCase for function names (as per the kotlin coding conventions ) battle is over and lost. I just wanted to vent (I am now refactoring the names of the functions in my code for the upper case start) that it looks weird that within composable functions it looks like I am instantiating a bunch of objects instead of calling actual functions. For all the other rebels that share this thought, I want to give the opportunity to press
F
to pay your respects to this fallen topic, and move on to the world of uppercase CamelCase function naming with me.
b
We'll after annotation processor us done, you're basically instantiating objects at that point. Also I like upper cased names because it clearly indicates when I'm creating a component.
j
As an implementer I am not interested in the inner workings of the library I am using. (I am of course interested in to how compose works 😄 but I mean in general) I should also not be aware during implementation what kind of magic the compiler does to generate working code. For me, from the outside, it looks like I am calling functions and then I should not care what compose is doing in the background.
b
And you shouldn't. All I'm saying is that there's some reasoning behind upper cased convention
j
yes that is true, I already started a discussion earlier and others as well 😛 so I do know there are reasons, but it doesn't mean I agree with them. But it is good that for you it does work and makes it more clear you are creating a component. I am sure that I will get used to it at one point as well.
b
As with most things, it just comes down to preference. You can't expect everyone to have the same one.
👍 1
f
And similar naming is in Kotlin standard library as well. Take for example a List "constructor". It's just top-level function:
List(10) { i -> "Index $i" }
So Compose is not introducing anything groundbreaking.
👍 3
v
This was released yesterday and explains reasons for decisions of this nature - https://github.com/androidx/androidx/blob/androidx-main/compose/docs/compose-api-guidelines.md
K 1