Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 228623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:41:52+00:00 2026-05-11T19:41:52+00:00

I’ve recently tried to write something in F# making use of Microsoft Solver Foundation

  • 0

I’ve recently tried to write something in F# making use of Microsoft Solver Foundation Services and while doing so I bumped into an issue: I had to express a (Term > Term) condition which in C# could simply be expressed as t1 > t2 and returns another Term object. In F#, instead, I had to call Term.op_GreaterThan in order to achieve the same result as using t1 > t2 would yield a bool and not a term.
Now I’m wondering why is F# only picking op_GreaterThan if it yields a boolean?
And what meaning would F#’s interpretation of t1 > t2 have while Term doesn’t implement IComparable?
Please mind that I understand why doing such a thing with equality and the whole equality based on structural comparison notion, I just don’t get how that could be extended to “greater than”/”smaller than” comparisons.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:41:52+00:00Added an answer on May 11, 2026 at 7:41 pm

    Textbook Answer:

    Operator overloading is not part of the Common Language Specification, meaning compiler writers are free to ignore or only partially support it if they feel like. As a library writer, you are responsible for providing alternate means for people to work with the class.

    Pragmatic Answer:

    Because it is a stupid thing to do in the first place. The op_GreaterThan method was explicitly created to make comparisons. That it, you aren’t supposed to do ‘interesting’ things with it like concatinating two terms. The CLR only lets you abuse it because it needs to support legacy languages like C++.

    By the way, there is an overload specifically for joining two things together. It is called op_Concatenate. You really should consider using it instead of op_GreaterThan.

    EDIT

    Almost Good Answer:

    In F# the concatination operator I mentioned is ^.

    I call this the almost-good answer because I’m not so sure that C# supports it. I think it is only allowed in VB and F#.

    EDIT #2

    It seems F# isn’t honoring the ^ overload after all.

    EDIT #3

    WTF is going on here? F# doesn’t honor the > operator at all. Sure you can overload it, and it will emit the op_GreaterThan method correctly, but it ignores it. It doesn’t even try to use op_GreaterThan, instead it looks for the System.IComparable interface.

    Even worse, this is a runtime check. Even though it can statically determine that class Foo doesn’t implement IComparable, it still goes ahead and compiles the code anyways.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.