|
Navigation
Recherche
|
F# 10 features scoped warning suppression
jeudi 20 novembre 2025, 23:53 , par InfoWorld
The newest version of Microsoft’s multi-paradigm language features a much-sought ability to suppress warnings in specified code sections.
With the scoped warning suppression capability, the compiler now supports the #warnon directive, which is paired with #nowarn to disable or enable warnings within a specific code span. The F# 10 update was introduced along with.NET 10 on November 11. Developers can get F# 10 by downloading.NET 10 or by accessing Visual Studio 2026 Insiders. A November 17 blog post introducing F# 10 notes that some changes to improve the consistency of #nowarn/#warnon directives were breaking changes, which could affect a codebase when updating to the new version. F# 10 also allows developers to apply distinct access modifiers to individual property accessors. This capability allows developers to specify access levels for the getter and setter of a property inline, enabling common patterns such as publicly readable but privately mutable state without verbose boilerplate. Another new capability in F# 10 enables optional parameters to use a struct-based ValueOption instead of the reference-based option type. This avoids a heap allocation for the option wrapper, which is beneficial in performance-critical code. Other improvements available in F# 10 include the following: Computation-expression builders now can opt into tail-call optimizations. A long-standing inconsistency in type annotation syntax for computation expression bindings has been resolved. Developers can now add type annotations on let!, use!, and and! bindings sans wrapping the identifier in parentheses. The discard pattern (_) now works in use! bindings within computation expressions. F# 10 allows using _ directly when binding asynchronous resources whose values are only needed for lifetime management. There is no need to provide a named identifier. Structural validation has been tightened to reject misleading module placement within types. F# 10 now raises an error when a module declaration appears indented at the same structural level inside a type definition, thus preventing a common source of confusion about module scoping. The compiler memoizes the results of type relationship checks, reducing redundant computations and improving compiler and tooling performance. In the FSharp.Core library, support has been added for and! in the task computation expression. Using task is a popular way to work with asynchronous workflows in F#, particularly when interoperability with C# is required. Three features—graph-based type checking, parallel IL code generation, and parallel optimization—are grouped together under the ParallelCompilationproject property. When publishing with trimming enabled (PublishTrimmed=true), the F# build now auto‑generates a substitutions file that targets the tooling‑only F# resources. This results in smaller output by default, less boilerplate, and one less maintenance hazard.
https://www.infoworld.com/article/4094019/f-10-features-scoped-warning-suppression.html
Voir aussi |
56 sources (32 en français)
Date Actuelle
ven. 21 nov. - 01:18 CET
|








