-
Notifications
You must be signed in to change notification settings - Fork 833
Open
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsFeature ImprovementTheme-Simple-F#A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.
Milestone
Description
What
When I try to define a class with getters/setters (and I forget how this is supposed to be defined):
type Foo() =
member __.Prop : int with get,setThe compiler gives
Error: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
Why
The syntax for some members (not only properties) can be difficult to remember when not used frequently (modules and functions are fine, but some frameworks insist on having properties, instance methods, etc.).
How
In my case, there is "with get,set" which is a clue I want a property, although I should have typed
type Foo() =
member val Prop = 0 with get, setI wish the compiler could help me out without resorting to google search.
related #1103
Metadata
Metadata
Assignees
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsFeature ImprovementTheme-Simple-F#A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.
Type
Projects
Status
In Progress