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

  • SEARCH
  • Home
  • 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 862473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:08:55+00:00 2026-05-15T09:08:55+00:00

Been grokking F# coming from a C# background. In C# there is a clear

  • 0

Been grokking F# coming from a C# background.

In C# there is a clear difference in deciding when to use interfaces and when to use abstract classes. In F# I see the two blurring almost into one. I understand under the hood that the same is being done in F# as c# as far as the CLR is concerned, but what is the “best practise” when programming in F# to use?

Should I avoid class inheritance altogether?

  • 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-15T09:08:55+00:00Added an answer on May 15, 2026 at 9:08 am

    I think that interfaces tend to be used much more frequently than abstract classes (compared to object-oriented languages like C#).

    In many cases, you don’t need any of the two, because you can just write higher-order function (that takes a function as an argument, instead of taking an interface as an argument). However, sometimes you may have two functions that are always used together – in that case, you can group two functions into an interface:

    // Instead of using higher-order function
    val foo : (int -> string) -> (string -> int) -> ...
    
    // ..we can define an interface
    type TwoWayConversion = 
      abstract ToString : int -> string
      abstract FromString : string -> int
    
    val foo : TwoWayConversion -> ...
    

    I think that this is quite useful F# programming pattern that uses interfaces in a perfectly functional style.

    On the other hand, I would use abstract classes only when writing object-oriented code that is supposed to be used from C# (e.g. C# code implementing your F# abstract class) – because that’s a natural extensibility point from the C# point of view. However, I think that idiomatic F# code uses different extensibility points than C# (e.g. taking function/interface as an argument), so you don’t really need abstract classes.

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

Sidebar

Related Questions

Been trying my best to understand this correctly. What is the difference between an
been working on this for two days now and seem to be getting nowhere.
Been working on this problem of collision detection and there appears to be 3
Been two days trolling through Google, stackoverflow, and docs.djangoproject.com for a solution to CSRF
Been creating a time code format from decimal seconds but now need to get
Been doing a bit of searching. I can see a method to add a
Been looking for some time now. Are URLs that directly use userIDs in some
Been going over my predecessor's code and see usage of the request scope frequently.
Been using PHP/MySQL for a little while now, and I'm wondering if there are
been scratching my head. I've followed the examples to use a jquery datepicker for

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.