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 6808423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:57:13+00:00 2026-05-26T19:57:13+00:00

Can it be done? I’ve been digging around and haven’t found anything as to

  • 0

Can it be done? I’ve been digging around and haven’t found anything as to whether or not it is possible.

The main reason I want to overload function call behavior is I have ended up with some code which uses some really complex closures, which capture lots and lots of local state to work with.

I find this sort of nested closures really confusing, and would like to convert them to full-fledged objects with a well-defined schema and inheritance and such, without changing the interface to the rest of the code.

  • 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-26T19:57:13+00:00Added an answer on May 26, 2026 at 7:57 pm

    F# does not support overloading of function application behavior, so you can’t write object that can be invoked in the same way as function. I’m afraid that you’ll have to change the interface to use something like:

    foo.Invoke(10, "Hello")
    

    Instead of:

    foo 10 "Hello"
    

    The use of objects generally also suggests that the entity is more complex, so by changing the interface, you give some hint to the developer calling it (saying that this is a complex type). Depending on your domain, you should also find some more descriptive name for Invoke.

    I also changed the syntax to use tupled method parameters instead of curried style – technically, you can use curried style for members too, but it is not generally used (it just works better for simple functions).

    Finally, if you’re finding that the closures represent more complex data structure, maybe you could make the data structure more explicit and define a type to hold the data. Then you could just use plain functions, but give them the data as an additional argument (although this is just a thought that may not really be useful for you).

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

Sidebar

Related Questions

it can be done using javascript, but with CSS alone, is it possible to
What can be done in Cpython that can not be done in IronPython?
What can be done to identify the reason for DB slowness? When i ran
Not sure if this can be done or if there is a good workaround.
not sure if this can actually be done - OK probably can be done
I'm not sure if this can be done. But I just wanted to check
How to plot and display Histogram of an Image ?If it can done using
This can be done with user32.dll on Windows. But how can i get it
This can be done by making a new HTTP handler, but is there a
What can be done about negative numbers in library item counts? ItemCount is a

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.