F# 4.0 发布,标准化 Array, List 和 Seq 模块
Visual F# 4.0 发布,此版本现已提供下载:
https://www.visualstudio.com/downloads/download-visual-studio-vs。
F# 4.0 包含新的语言特性:
-
构造函数作为一级函数
-
可变值的使用简化
-
支持高维的数组
-
支持方法中的静态参数
-
简化列表的语法
-
简化 printf 函数的使用
-
GC 优化提升性能
API 改进:
-
标准化和扩展
Array,List和Seq模块 -
New APIs for 4.0:
chunkBySize,contains,except,findBack,findInstanceBack,indexed,item,mapFold,mapFoldBack,sortByDescending,sortDescending,splitInto,tryFindBack,tryFindIndexBack,tryHead,tryItem,tryLast
-
其他新 API
-
Option.filter,Option.toObj,Option.ofObj,Option.toNullable,Option.ofNullable -
String.filter -
Checked.int8,Checked.uint8 -
Async.AwaitTask(non-generic) -
WebClient.AsyncDownloadFile,WebClient.AsyncDownloadData -
tryUnbox,isNull
其他值得关注的改进:
-
New active pattern to match constant
Decimalin quotations -
Slicing support for lists
-
Support for consuming high-rank (> 4) arrays
-
Support for units of measure in
printf-family functions -
Support for constructors/class names as first-class functions
-
Improved exception stack traces in async code
-
Automatic
mutable/refconversion -
Support for static arguments to provided methods
-
Support for non-nullable provided types
-
Added
NonStructuralComparisonmodule containing non-structural comparison operators -
Support for rational exponents in units of measure
-
Give fsi.exe, fsiAnyCpi.exe nice icons
-
Microsoft.optional in namepsace paths from FSharp.Core -
Support for extension properties in object initializers
-
Pre-support (not yet used) for additional nativeptr intrinsics
-
Simplified, more robust resolution of type references in quotations
-
Support for inheritance of types that have multiple interface instantiations
-
Extended preprocessor grammar
-
Support for implicit quotation of expressions used as method arguments
-
Support for multiple properties in
[<StructuredFormatDisplay>] -
Eliminate tuple allocation for implicitly returned formal arguments
-
Perf: fsc.exe now uses
GCLatencyMode.Batch -
Perf: Improved
hash/compare/distinctBy/groupByperformance -
Perf:
Seq.toArrayperf improvement -
Perf: Use
OptimizedClosures.FSharpFuncin seq.fs where applicable -
Perf: Use literals and mutable variables instead of ref cells for better performance in SHA1 calc
-
Perf: Use smart blend of
System.Array.Copyand iterative copy for array copies -
Perf: Change
Seq.toListto mutation-based to remove reliance onList.rev -
Perf: Change
pdbCloseto test if files are locked before inducing GCs -
Perf: Use server GC mode for compiler
Visual Studio 方面的改进:
-
Updated all templates (except tutorial) to include AssemblyInfo.fs setup in the same manner as default C# project templates
-
Add keyboard shortcuts for FSI reset and clear all
-
Improved debugger view for Map values
-
Improved performance reading stdout/stderr from fsi.exe to F# Interactive window
-
Support for VS project up-to-date check
-
Improved project template descriptions, make it clearer how to target Xamarin platforms
-
Intellisense completion in object initializers
-
Add menu entry "Open folder in File Explorer" on folder nodes
-
Intellisense completion for named arguments
-
Alt+Entersends current line of code to interactive if there is no selection -
Support for debugging F# scripts with the VS debugger
-
Add support for hexadecimal values (like 0xFF) ??to MSBuild property BaseAddress
-
Updated menu icons used for F# interactive to align with other VS interactive windows
此外还有写 bug 修复,详细改进内容请看更新日志。
F#是由微软发展的为微软.NET语言提供运行环境的程序设计语言,是函数编程语言(FP,Functional Programming),函数编程语言最重要的基础是Lambda Calculus。它是基于OCaml的,而OCaml是基于ML函 数程式语言。有时F# 和 OCaml 的程式是可以交互编译的。
F#已经接近成熟,支援Higher-Order Function、Currying、Lazy Evaluation、Continuations、Pattern Matching、Closure、List Processing、Meta-Programming。这是一个用于显示.NET在不同编程语言间互通的程序设计,可以被.NET中的任意其它代码编 译和调用。
F#将被集成在Visual Studio 2010中,含有对.Net Framework的完全支持。