F# 4.0 發布,標準化 Array, List 和 Seq 模塊

jopen 9年前發布 | 9K 次閱讀 F#

Visual F# 4.0 發布,此版本現已提供下載:

https://www.visualstudio.com/downloads/download-visual-studio-vs

F# 4.0 包含新的語言特性:

  • 構造函數作為一級函數

  • 可變值的使用簡化

  • 支持高維的數組

  • 支持方法中的靜態參數

  • 簡化列表的語法

  • 簡化 printf 函數的使用

  • GC 優化提升性能

API 改進:

  • 標準化和擴展 Array, ListSeq 模塊

    • New APIs for 4.0: chunkBySize, contains, except, findBack, findInstanceBack, indexed, item, mapFold, mapFoldBack, sortByDescending, sortDescending, splitInto, tryFindBack, tryFindIndexBack, tryHead, tryItem, tryLastF# 4.0 發布,標準化 Array, List 和 Seq 模塊

  • 其他新 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

    </ul>

    其他值得關注的改進:

    • New active pattern to match constant Decimal in 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/ref conversion

    • Support for static arguments to provided methods

    • Support for non-nullable provided types

    • Added NonStructuralComparison module 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/groupBy performance

    • Perf: Seq.toArray perf improvement

    • Perf: Use OptimizedClosures.FSharpFunc in 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.Copy and iterative copy for array copies

    • Perf: Change Seq.toList to mutation-based to remove reliance on List.rev

    • Perf: Change pdbClose to 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+Enter sends 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的完全支持。

     本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
     轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
     本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!