WebSharper 4 (codename Zafir) beta-5

@Jand42 Jand42 released this Dec 7, 2016 · 94 commits to master since this release



  • Pattern matching on arrays when also matching against null
  • #616: Handle MSBuild variables ending with \
  • #618: Recursive F# values which use functions defined after work properly, for example let rec answer = ask() and ask() = 42
  • Fix AjaxRemotingProvider, allow inheriting, overridable AsyncBase and Endpoint members
  • #623: @file command line argument supported, needed for large projects
  • F# Set constructor proxy erases duplicate elements
  • Dictionary proxy supports multiple items with the same hash, added Key and Value properties (currently not lazy evaluating, see #630)
  • Fixed Enum.HasFlag proxy
  • #629: trait calls on iterfaces compiling (For example using the WebSharper.UI.Next.Notation operators on a WebSharper.UI.Next.IRef)
  • #631: don't CSRF-check allowed CORS origins
  • Client-side JSON serialization fixes:
    • 621: Dictionary<string,> and Map<string,> JSON deserialization
    • generating type dependencies correctly for use in SPA projects (which use dead-code elimination)
    • fix optional fields in unions
  • #633: Interface members defined with WIG use wrong name when translated


  • Updated to FSharp.Compiler.Service version 8.0 which has improvements to compilation speed and new features coming with F# 4.1
  • Code output organization: local let function declarations that translate into a local JavaScript function are not moved to top of code block
  • Immutable struct declarations now usable in client-side code, not yet for remoting
  • System.Lazy proxy now releases reference to function argument when evaluated
  • Static constructors erasing themselves from global JavaScript value after running

Breaking changes

  • Type inference changes introduced by latest FSharp.Compiler.Service can be breaking. We have changed WIG Generic helper operators which can be used to construct generic types and members to have different character lengts based on arity: for example use Generic -- fun t1 t2 -> ... instead of just Generic - fun t1 t2 -> ...
  • Constructing a default value for example Unchecked.defaultof now always uses compile-time type information. This can be problematic if the type is a generic parameter. For example using match dict.TryGetValue x with ... can throw an error if dict has a generic value type, as the F# compiler is implicitly creating a default value to pass to the out parameter of TryGetValue. You can get around it by wrapping the expression in the new helper DefaultToUndefined which allows translating default values inside to just undefined: match DefaultToUndefined(dict.TryGetValue x) with ...