Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.36 KB

FS-1046-wildcard-self-identifiers.md

File metadata and controls

60 lines (39 loc) · 1.36 KB

F# RFC FS-1046 - Wildcard self identifiers

The design suggestion Wildcard self identifiers has been marked "approved in principle". This RFC covers the detailed proposal for this suggestion.

Summary

Allow single underscore character as ignored self identifier.

Motivation

Makes underscore semantic more consistent across the language.

Detailed design

Current workaround for ignoring self identifier in instance members is to use double underscores:

type C() = 
   member __.P = 1

Suggestion is to enhance parse to allow single underscore::

type C() = 
   member _.P = 1

Currently above results in syntax error:

Unexpected symbol '.' in member definition. Expected 'with', '=' or other token."

Drawbacks

Additional complexity in parsing rules.

Alternatives

Continue using double underscore workaround.

Compatibility

No compatibility issues identified.

Unresolved questions

None.