<@U3ZLHBTLG> What do you think about adding overlo...
# splitties
i
@louiscad What do you think about adding overload for
view.dip()
to be able to deal with floating values where needed. Because without that you have to use your own helper or write extra code:
Copy code
elevation = dip(4).toFloat()
Or dp(4) should be used? I'm just not sure about convention, but for me
dip()
fits better both for float and int.
l
@ispbox Yes,
dp
is for that.
i
OK, but what is the purpose for having both
dp
and
dip
? What`s wrong with overloading of
dip
?
You can argue that overloads are only possible for different parameter types (now they are both
Int
), but how to make elevation of 3.5f? 🙂 It should be float anyways.
l
@ispbox You can't overload based on return type.
i
This is what I was saying in my last comment. I would propose these two methods:
Copy code
dip(Int): Int
dip(Float): Float
They could be easily overloaded. The only "problem" is that you have to write:
Copy code
elevation = dip(4f)
But that is not a problem, it is a feature to be able to set floating point elevation, i.e.:
Copy code
elevation = dip(3.5f)
l
Hum, I see, could be a great feature, I agree
Just checked the sources, and you convinced me! Do you want to submit a PR on the develop branch or should I do it myself?
i
Sorry, Louis, but please do that yourself, as it could influence some other code / public API. I don't know whether you should mark old API as deprecated or something similar (I mean
dp()
).
l
@ispbox Now I'm realizing I can equally use
dip
or
dp
. Please vote here: https://kotlinlang.slack.com/archives/CHJP9K00L/p1569187453013900