I suggest we ...

Avoid boxing when comparing value types

When emitting code for comparison operators, the F# compiler already special-cases numeric types. I suggest that, when other value types have the appropriate operator, code is emitted to use it. I.e., the compiler should produce the equivalent of:

let inline (<=) (x: ^a when ^a: struct) (y: ^a) =
(^a: (static member (<=): ^a * ^a -> bool) (x, y))

4 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Greg Chapman shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Abel commented  · 

        Just a note: while this has status "declined", it was a duplicate and the duplicate has been completed/resolved in F# 4.0.

      F# Language

      Feedback and Knowledge Base