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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:58:28+00:00 2026-05-23T09:58:28+00:00

I have a file with a module with some routines that take parameters and

  • 0

I have a file with a module with some routines that take parameters and return unit, these routines have side-effects. I noticed that when accessing these f# routines from c# they’re actually properties of type unit and when I try to access 1 property, it runs all properties in the module.

From the F# documentation all top level do bindings are run on type initialization.

What is the preferred way to write functions that should not be run on type initialization but are also not associated with other state i.e. a class with functions and member variables?

Should I put these functions inside a type and just have no records in the type?

Code example:

namespace test_space

open System.Diagnostics;

module test =
    let test_1 =
        Debug.WriteLine ("One")

    let test_2 =
        Debug.WriteLine ("Two")

I’m running this code with C#:

static void Main (string [] args)
{
    Object o;

    o = test.test_2;
}

And the output is:

One
Two

  • 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-23T09:58:29+00:00Added an answer on May 23, 2026 at 9:58 am

    The problem is you didn’t create functions but value bindings. test_1 is a value. test_1() is a function of type unit -> unit. Make sure you put () after the function name.

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

Sidebar

Related Questions

I have a file that I want to read in using the File::Slurp module
I have a file which is an XML representation of some data that is
I have written a module that has some generic, reusable code that I would
i have a module (a single .py file, actually), with a class called HashedDir.
In the filesystem I have /file.aspx /directory/default.aspx I want to configure IIS so that
I have a file that I want to include in Python but the included
I have a file temp.txt, that I want to sort with the sort command
I have a file with the following syntax in some_1.xyz module some_1 { INPUT
I have XML file (output of some application) like this: <data> <call function=get_user_data> <output>
I have some configuration options for a program stored in a JSON file. I

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.