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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:47:24+00:00 2026-05-13T14:47:24+00:00

I am using the F# CTP 1.9.7.8 and running the samples based on Tomas

  • 0

I am using the F# CTP 1.9.7.8 and running the samples based on Tomas Petricek’s article, on page 12

type MyCell(n:int) =
   let mutable data = n + 1
   do printf "Creating MyCell(%d)" n

   member x.Data
     with get() = data
     and  set(v) = data <- v

   member x.Print() =
     printf "Data %d" n

   override x.ToString() = 
     sprintf "(Data %d)" data

   static member FromInt(n) = 
     MyCell(n)

Four questions comes into mind as I typed this into the F# Interactive:

  1. Why do I get an error message as shown below in Figure 1.
  2. Why is there an = beside the member x.Print(), x.ToString() but not in member x.Data?
  3. Where did the x come from? and why is it there when the type MyCell is being defined so how can you reference an ‘object’ in that way, such as for x.Print(), x.ToString() and x.Data?
> type MyCell(n:int) =
- let mutable data = n + 1

  type MyCell(n:int) =
  -----^^^^^^^

stdin(6,6): error FS0547: A type definition requires one or more members or othe
r declarations. If you intend to define an empty class, struct or interface, the
n use 'type ... = class end', 'interface end' or 'struct end'.
-

Figure 1.

Thanks,
Best regards,
Tom.

  • 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-13T14:47:24+00:00Added an answer on May 13, 2026 at 2:47 pm
    1. As pblassucci said, you need to indent your class’s contents.
    2. Print and ToString are methods, but Data is a property, so for Data the = comes before the definitions of the get and set methods.
    3. Instead of always using an identifier like this to refer to the class whose members are being defined, F# lets you choose an identifier on a member-by-member basis. x is used in many examples, but the choice is arbitrary.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET MVC4 (EF Code-first) with WCF ADO.NET Data Service October 2011 CTP.
I'm using the Microsoft.Data.Entity.CTP (in the Entity Framework CTP) under the .NET 4 framework
Is there any recommendation against using this CTP? Is it unstable?
In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine: module
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
I'm implementing an oauth provider using DotNetOpenAuth CTP library. So I have created an
I am using the Async CTP library for Windows Phone. Does anyone know how
I have been using Entity Framework CTP with Code-First as in this tutorial by
I'm using Visual C# 2010 Express RTM with Windows Phone Developer Tools April CTP
I am using cakePHP 1.26. In a .ctp file, I have a few like

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.