During constraint solving (§14.5), the constraint type : not struct is met if type is a reference type. Note: This constraint form exists primarily to provide the full set of constraints that CLI implementations allow. It is rarely used in F# programming. Enumeration Constraints An explicit enumeration constraint has the following form: typar : enum<underlying-type> During constraint solving (§14.5), the constraint type : enum<underlying-type> is met if type is a CLI or F# enumeration type that has constant literal values of type underlying-type. Note: This constraint form exists primarily to allow the definition of library functions such as enum. It is rarely used directly in F# programming. The enum constraint does not imply anything about subtypes. For example, an enum constraint does not imply that the type is a subtype of System.Enum. Delegate Constraints An explicit delegate constraint has the following form: typar : delegate<tupled-arg-type, return-type> During constraint solving (§14.5), the constraint type : delegate<tupled-arg-type, return-types> is met if type is a delegate type D with declaration type D = delegate of object * arg1 * ... * argN and tupled-arg-type = arg1 * ... * argN. That is, the delegate must match the CLI design pattern where the sender object is the first argument to the event. Note: This constraint form exists primarily to allow the definition of certain F# library functions that are related to event programming. It is rarely used directly in F# programming. The delegate constraint does not imply anything about subtypes. In particular, a ‘delegate’ constraint does not imply that the type is a subtype of System.Delegate. The delegate constraint applies only to delegate types that follow the usual form for CLI event handlers, where the first argument is a “sender” object. The reason is that the purpose of the constraint is to simplify the presentation of CLI event handlers to the F# programmer. Unmanaged Constraints An unmanaged constraint has the following form: typar : unmanaged
During constraint solving (§14.5), the constraint type : not struct is met if type is a reference type. Note: This constraint form exists primarily to provide the full set of constraints that CLI implementations allow. It is rarely used in F# programming. Enumeration Constraints An explicit enumeration constraint has the following form: typar : enum<underlying-type> During constraint solving (§14.5), the constraint type : enum<underlying-type> is met if type is a CLI or F# enumeration type that has constant literal values of type underlying-type. Note: This constraint form exists primarily to allow the definition of library functions such as enum. It is rarely used directly in F# programming. The enum constraint does not imply anything about subtypes. For example, an enum constraint does not imply that the type is a subtype of System.Enum. Delegate Constraints An explicit delegate constraint has the following form: typar : delegate<tupled-arg-type, return-type> During constraint solving (§14.5), the constraint type : delegate<tupled-arg-type, return-types> is met if type is a delegate type D with declaration type D = delegate of object * arg1 * ... * argN and tupled-arg-type = arg1 * ... * argN. That is, the delegate must match the CLI design pattern where the sender object is the first argument to the event. Note: This constraint form exists primarily to allow the definition of certain F# library functions that are related to event programming. It is rarely used directly in F# programming. The delegate constraint does not imply anything about subtypes. In particular, a ‘delegate’ constraint does not imply that the type is a subtype of System.Delegate. The delegate constraint applies only to delegate types that follow the usual form for CLI event handlers, where the first argument is a “sender” object. The reason is that the purpose of the constraint is to simplify the presentation of CLI event handlers to the F# programmer. Unmanaged Constraints An unmanaged constraint has the following form: typar : unmanaged
FSharpSpec-4.1-latest.docx