Skip to content
Andrey Kurosh edited this page Jun 22, 2017 · 11 revisions

Version 4.1

  • Verbatim strings

  • Multiple variables declaration:

    var a, b, c: Func<int, int>
  • Shorthand method for function registration on host side:

    compiler.RegisterFunction<Func<int, int>>("doubler", x => x * 2);
  • Fixes for char & regex literals with escape sequences

Version 4.0

  • Pattern matching

  • Shorthand assignment operators:

    x += 1
  • Enhanced operator semantics for collections - concatenation via + operator and repetition via *:

    var data = new [1; 2; 3]
    data + data // [1; 2; 3; 1; 2; 3]
    data * 2    // the same
  • Improved error reporting in Lens Console

Version 3.0

  • Automatic inference for lambda argument types:

    new [1; 2; 3; 4; 5]
        |> Where x -> x**2 < 10 // x is inferred to be int

    Also, braces are no longer required if lambda is the only argument of a method.

  • Full support for variadic functions and constructors

  • Instantiation of empty arrays by size, like in C#

  • Partial application for any callable types:

    let sum = (x:int y:int) -> x + y
    let add3 = sum _ 3
  • The using block to manage IDisposable resources:

    using x = new FileStream "file.txt" do
        x.Write "some data"
  • Underscore name for unneeded arguments in lambdas and functions

Fixed bugs:

  • Loop variables are now closured correctly
  • Calling a method of a base interface type on derived one now works
  • Built-in types now work properly in saved assemblies

Version 2.0

  • The parser has been completely rewritten:

    • FSharp and FParsec dependencies removed
    • Huge speed-up
    • Improved error reporting
    • The entire compiler is now a single assembly of 270 kb.
  • The for loop that works as both for and foreach loops:

    for a in 1..10 do
        print "a"
  • The pure modifier enables automatic memoization for a function

  • Unitialized variables: var x : int

  • Multiline object initializers

    var x = new [
        "hello there"
        fmt "{0}, {1} and {2}" 1 true 2.5
    ]
  • Various syntax improvements:

    • Function definitions became more clear with arguments in parens:

      fun add:int (x:int y:int) -> x + y
    • No braces around the single argument of a lambda:

      getPoints ()
          |> Where (p:Point -> p.X < 10)
          |> Select (p:Point -> fmt "{0}:{1}" p.X p.Y)
    • No braces for if, while and catch:

      try
          if a > 10 then
              fail "error"
          else
              while a < 10 do
                  println "a = {0}" a
                  a = a + 1
      catch e:Exception
          print "fail: {0}" e.Message

Version 1.1

  • Constant expressions are evaluated at compile time
  • finally keyword for the try block
  • Several bugfixes

Version 1.0

Initial LENS compiler version.

Clone this wiki locally