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
Expose {Int,Int32,Int64,Nativeint}.{min,max} #10389
Comments
Sounds good! One small implementation issue that I can think of is that |
Do you see a strong reason to avoid such dependencies? But yes, inlining min or max on |
+1 for adding -1 for deprecating |
Ok! What about |
I don't think of |
Stdlib.{min,max}
are quite bad performance-wise (even when inlined, they will still call the polymorphic comparison C primitive). In #10251, I proposed to add compiler primitives to allow the optimizer generate better code when those functions are used on simple numerical types, but @xavierleroy's position (#10251 (comment)) is rather that these functions should eventually go away, and one should stop using them.So, I believe we should:
Int
,Int32
,Int64
,Nativeint
. ForChar
,Uchar
andString
, it's less obviously useful. ForBool
, we already have||
and&&
, but it could still perhaps be useful (for the sake of uniformity, and also to avoid the short-circuit behavior?). ForFloat
, the functions already exist (also with*_num
variants); idem for Zarith`s Q and Z modules. Are people using those functions on non-numerical types?Stdlib.{min,max}
as being deprecated, in order to help users spot the usually inefficient call sites, and prepare for a possible removal.The text was updated successfully, but these errors were encountered: