Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
2Activity

Table Of Contents

1 Introduction
1.1 A First Program
Lightweight Syntax
Making Data Simple
Making Types Simple
Functional Programming
Imperative Programming
.NET Interoperability and CLI Fidelity
Parallel and Asynchronous Programming
Stronger Typing for Floating-Point Code
Object-Oriented Programming and Code Organization
1.2 Notational Conventions in This Specification
2 Program Structure
3 Lexical Analysis
3.1 Whitespace
3.2 Comments
3.3 Conditional Compilation
3.4 Identifiers and Keywords
3.5 Strings and Characters
3.6 Symbolic Keywords
3.7 Symbolic Operators
3.8 Numeric Literals
3.8.1 Post-filtering of Adjacent Prefix Tokens
3.8.2 Post-filtering of Integers Followed by Adjacent “..”
3.8.3 Reserved Numeric Literal Forms
3.9 Line Directives
3.10 Hidden Tokens
3.11 Identifier Replacements
4 Basic Grammar Elements
4.1 Operator Names
4.2 Long Identifiers
4.3 Constants
4.4 Operators and Precedence
4.4.1 Categorization of Symbolic Operators
4.4.2 Precedence of Symbolic Operators and Pattern/Expression Constructs
5 Types and Type Constraints
5.1 Checking Syntactic Types
5.1.1 Named Types
5.1.2 Variable Types
5.1.3 Tuple Types
5.1.4 Array Types
5.1.5 Constrained Types
5.2 Type Constraints
5.2.1 Subtype Constraints
5.2.2 Nullness Constraints
5.2.3 Member Constraints
5.2.4 Default Constructor Constraints
5.2.5 Value Type Constraints
5.2.6 Reference Type Constraints
5.2.7 Enumeration Constraints
5.2.8 Delegate Constraints
5.2.9 Unmanaged Constraints
5.2.10 Equality and Comparison Constraints
5.3 Type Parameter Definitions
5.4 Logical Properties of Types
5.4.1 Characteristics of Type Definitions
5.4.2 Expanding Abbreviations and Inference Equations
5.4.3 Type Variables and Binding
5.4.4 Base Type of a Type
5.4.5 Interfaces Types of a Type
5.4.6 Type Equivalence
5.4.7 Subtyping and Coercion
5.4.8 Nullness
5.4.9 Default Initialization
5.4.10 Dynamic Conversion Between Types
6 Expressions
6.1 Some Checking and Inference Terminology
6.2 Elaboration and Elaborated Expressions
6.3 Data Expressions
6.3.1 Simple Constant Expressions
6.3.2 Tuple Expressions
6.3.3 List Expressions
6.3.4 Array Expressions
6.3.5 Record Expressions
6.3.6 Copy-and-update Record Expressions
6.3.7 Function Expressions
6.3.8 Object Expressions
6.3.9 Delayed Expressions
6.3.10 Computation Expressions
6.3.11 Sequence Expressions
6.3.12 Range Expressions
6.3.13 Lists via Sequence Expressions
6.3.14 Arrays via Sequence Expressions
6.3.15 Null Expressions
6.3.16 'printf' Formats
6.4 Application Expressions
6.4.1 Basic Application Expressions
6.4.2 Object Construction Expressions
6.4.3 Operator Expressions
6.4.4 Late Binding Operator Expressions
6.4.5 The AddressOf Operators
6.4.6 Lookup Expressions
6.4.7 Slice Expressions
6.4.8 Member Constraint Invocation Expressions
6.4.9 Assignment Expressions
6.5 Control Flow Expressions
6.5.1 Parenthesized and Block Expressions
6.5.2 Sequential Execution Expressions
6.5.3 Conditional Expressions
6.5.4 Shortcut Operator Expressions
6.5.5 Pattern-Matching Expressions and Functions
6.5.6 Sequence Iteration Expressions
6.5.7 Simple for-Loop Expressions
6.5.8 While Expressions
6.5.9 Try-with Expressions
6.5.10 Reraise Expressions
6.5.11 Try-finally Expressions
6.5.12 Assertion Expressions
6.6 Binding Expressions
6.6.1 Binding Expressions
6.6.2 Recursive Binding Expressions
6.6.3 Deterministic Disposal Expressions
6.7 Type-Related Expressions
6.7.1 Type-Annotated Expressions
6.7.2 Static Coercion Expressions
6.7.3 Dynamic Type-Test Expressions
6.7.4 Dynamic Coercion Expressions
6.8 Quoted Expressions
6.8.1 Strongly Typed Quoted Expressions
6.8.2 Weakly Typed Quoted Expressions
6.8.3 Expression Splices
6.9 Evaluation of Elaborated Forms
6.9.19 Evaluating Dynamic Coercion Expressions
6.9.20 Evaluating Sequential Execution Expressions
6.9.21 Evaluating Try-with Expressions
6.9.22 Evaluating Try-finally Expressions
6.9.23 Evaluating AddressOf Expressions
6.9.24 Values with Underspecified Object Identity and Type Identity
7 Patterns
7.1 Pattern Forms
7.1.1 Simple Constant Patterns
7.1.2 Named Patterns
7.1.3 Union Case Patterns
7.1.4 Literal Patterns
7.1.5 Active Patterns
7.1.6 “As” Patterns
7.1.7 Wildcard Patterns
7.1.8 Disjunctive Patterns
7.1.9 Conjunctive Patterns
7.1.10 “Cons” and List Patterns
7.1.11 Type Annotated Patterns
7.1.12 Dynamic Type-Test Patterns
7.1.13 Record Patterns
7.1.14 Array Patterns
7.1.15 Null Patterns
7.1.16 Guarded Pattern Rules
8 Type Definitions
8.1 Type Definition Group Checking and Elaboration
8.2 Type Kind Inference
8.3 Type Abbreviations
8.4 Record Type Definitions
8.4.1 Members in Record Types
8.4.2 Name Resolution and Record Field Labels
8.4.3 Structural Hashing, Equality, and Comparison for Record Types
8.5 Union Type Definitions
8.5.1 Members in Union Types
8.5.2 Structural Hashing, Equality, and Comparison for Union Types
8.5.3 Compiled Form of Union Types for Use from Other CLI Languages
8.6 Class Type Definitions
8.6.1 Primary Constructors in Classes
8.6.2 “let” and “do” Declarations in Primary Constructors
8.6.3 Members in Classes
8.6.4 Additional Object Constructors in Classes
8.6.5 Additional Fields in Classes
8.7 Interface Type Definitions
8.8 Struct Type Definitions
8.9 Enum Type Definitions
8.13.1 Property Members
8.13.2 Method Members
8.13.3 Curried Method Members
8.13.4 Named Arguments to Method Members
8.13.5 Optional Arguments to Method Members
8.13.6 Type-directed Conversions at Member Invocations
8.13.7 Overloading of Methods
8.13.8 Naming Restrictions for Members
8.13.9 Members Represented as Events
8.13.10 Members Represented as Static Members
8.14 Abstract Members and Interface Implementations
8.14.1 Abstract Members
8.14.2 Members Implementing Abstract Members
8.14.3 Interface Implementations
8.15 Equality, Hashing, and Comparison
8.15.1 Equality Attributes
8.15.2 Comparison Attributes
8.15.3 Behavior of the Generated Object.Equals Implementation
8.15.4 Behavior of the Generated CompareTo Implementations
8.15.5 Behavior of the Generated GetHashCode Implementations
8.15.6 Behavior of hash, =, and compare
9 Units Of Measure
9.1 Measures
9.2 Constants Annotated by Measures
9.3 Relations on Measures
9.3.1 Constraint solving
9.3.2 Generalization of Measure Variables
9.4 Measure Definitions
9.5 Measure Parameter Definitions
9.6 Measure Parameter Erasure
9.7 Type Definitions with Measures in the F# Core Library
10 Namespaces and Modules
10.1 Namespace Declaration Groups
10.2 Module Definitions
10.2.1 “let” Bindings in Modules
10.2.2 Literal Definitions in Modules
10.2.3 Type Function Definitions in Modules
10.2.4 Active Pattern Definitions in Modules
10.2.5 “do” Bindings in Modules
10.3 Import Declarations
10.4 Module Abbreviations
10.5 Accessibility Annotations
10.5.1 Permitted Locations of Accessibility Modifiers
11 Namespace and Module Signatures
11.1 Signature Elements
11.1.1 Value Signatures
11.1.2 Type Definition Signatures
11.1.3 Member Signatures
11.2 Signature Conformance
11.2.1 Signature Conformance for Values
11.2.2 Signature Conformance for Members
12 Program Structure and Execution
12.1 Implementation Files
12.2 Signature Files
12.3 Script Files
12.4 Compiler Directives
12.5 Program Execution
12.5.1 Execution of Static Initializers
12.5.2 Explicit Entry Point
13 Custom Attributes and Reflection
13.1 Custom Attributes
13.1.1 Custom Attributes and Signatures
13.2 Reflected Forms of Declaration Elements
14 Inference Procedures
14.1 Name Resolution
14.1.1 Name Environments
14.1.2 Name Resolution in Module and Namespace Paths
14.1.3 Name Resolution in Expressions
Name Resolution in Module and Namespace Paths
14.1.4 Name Resolution for Members
14.1.5 Name Resolution in Patterns
14.1.6 Name Resolution for Types
14.1.7 Name Resolution for Type Variables
14.1.8 Field Label Resolution
14.1.9 Opening Modules and Namespace Declaration Groups
14.2 Resolving Application Expressions
14.2.1 Unqualified Lookup
14.2.2 Item-Qualified Lookup
14.2.3 Expression-Qualified Lookup
14.3 Function Application Resolution
14.4 Method Application Resolution
14.4.1 Conditional Compilation of Member Calls
14.4.2 Implicit Insertion of Flexibility for Uses of Values and Members
14.5 Constraint Solving
14.5.1 Solving Equational Constraints
14.5.2 Solving Subtype Constraints
14.5.3 Solving Nullness, Struct and Other Simple Constraints
14.5.4 Solving Member Constraints
14.5.5 Over-constrained User Type Annotations
14.6 Checking and Elaborating Bindings
14.6.1 Ambiguities in Bindings
14.6.2 Mutable Bindings
14.6.3 Processing Value Definitions
14.6.4 Processing Function Definitions
14.6.5 Processing Member Definitions
14.6.6 Processing Recursive Groups of Bindings
14.6.7 Recursive Safety Analysis
14.6.8 Generalization
14.6.9 Condensation of Generalized Types
14.7 Dispatch Slot Inference
14.8 Dispatch Slot Checking
14.9 Byref Safety Analysis
14.10 Arity Inference
14.11 Additional Constraints on CLI Methods
15 Lexical Filtering
15.1 Lightweight Syntax
15.1.1 Basic Lightweight Syntax Rules by Example
15.1.2 Inserted Tokens
15.1.3 Grammar Rules Including Inserted Tokens
15.1.4 Offside Lines
15.1.5 The Pre-Parse Stack
15.1.6 Full List of Offside Contexts
15.1.7 Balancing Rules
15.1.8 Offside Tokens, Token Insertions, and Closing Contexts
15.1.9 Exceptions to the Offside Rules
15.1.10 Permitted Undentations
15.2 High Precedence Application
15.3 Lexical Analysis of Type Applications
16 Special Attributes and Types
16.1.1 Custom Attributes Recognized by F#
16.1.2 Custom Attributes Emitted by F#
16.1.3 Custom Attributes Not Recognized by F#
16.2 Exceptions Thrown by F# Language Primitives
17 The F# Library FSharp.Core.dll
17.1 Basic Types (Microsoft.FSharp.Core)
17.1.1 Basic Type Abbreviations
17.1.2 Basic Types that Accept Unit of Measure Annotations
17.1.3 nativeptr<_>
17.2 Basic Operators and Functions (Microsoft.FSharp.Core.Operators)
17.2.1 Basic Arithmetic Operators
17.2.2 Generic Equality and Comparison Operators
17.4.2 The Option Type
17.5 Lazy Computations (Lazy)
17.6 Asynchronous Computations (Async)
17.7 Agents (MailboxProcessor)
17.8 Event Types
17.9 Immutable Collection Types (Map, Set)
17.10 Text Formatting (Printf)
17.11 Reflection
17.12 Quotations
Glossary
Index
0 of .
Results for:
No results containing your search query
P. 1
FSharp Language Specification 2.0

FSharp Language Specification 2.0

Ratings: (0)|Views: 7,114|Likes:
Published by robertwharvey

More info:

Published by: robertwharvey on Nov 04, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/05/2011

pdf

text

original

You're Reading a Free Preview
Pages 6 to 82 are not shown in this preview.
You're Reading a Free Preview
Pages 88 to 115 are not shown in this preview.
You're Reading a Free Preview
Pages 121 to 223 are not shown in this preview.
You're Reading a Free Preview
Page 229 is not shown in this preview.
You're Reading a Free Preview
Pages 235 to 250 are not shown in this preview.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->