Allow float keywords in to_timeout/1.#15400
Conversation
a288bd2 to
606250e
Compare
|
Thank you but I am not comfortable with supporting floats, given the imprecision from operations and the fact timeouts in Erlang are only integer too. I understand the application specific concerns but then I suggest those be tackled by the application. :) PS: if we were to merge it, then I would suggest rounding up, as timeout guarantees “at least”. But as per above, I wouldn’t go ahead with this feature. |
|
Your reservations make sense! This PR does in fact round to always get integers, and always rounds up, to eat the imprecisions, FWIW. See:
|
|
We won't go ahead with this, per above. :)
Ah, perfect. I got confused with the mailing message then! |
Per core discussion, I ran into another situation with a dynamically-calculated rate limit from an API response (in fractional minutes), and thought I would proffer an implementation.
While floats are not allowed in
Durations, it makes sense to me that since the purpose ofto_timeout/1is not to construct aDuration, a general-purposeKernelfunction should be made more flexible. Duration and simple numeric arguments still require integers, to encourage thinking of timeouts on millisecond timescales.I understand the mailing list discussion did not end with a [👍 PRs welcome], so feel free to close if the argument for this form is not sufficiently persuasive.