F# Language

News in .NET 4 and Visual Studio 2010 release wave – part five

a. Multiparadigm language with support of functional programming, object oriented programming and language oriented programming.

For the sake of the language, simple pow function to return power of value:

> let rec pow n x =
match n with | 0 -> 1.
| n -> x * pow (n – 1) x;;
val pow : int -> float -> float

And after using interactive shell, the result will be:

> square 5.;;
val it : float = 25.0;;

 

This is series of articles News in .NET 4 and Visual Studio 2010 release wave

Links:

The F#.NET Journal: Introduction to F#

What is new in C# 4.0

News in .NET 4 and Visual Studio 2010 release wave – part three

In new version of C# are main features to support of dynamic languages and DLR interop and also better support for earier COM interop.

  1. Dynamic keyword to Support for dynamic languages. Dynamic allows to specify non-strict type and compiler will make any complain.

    image 
    Picture: IntelliSense will make no advises on dynamic object which are not strongly typed.

    Ability of .NET Framework to call a method at runtime instead of binding at compile time is called Dynamic lookup and is provided by DLR runtime.

  2. Dynamic lookup – allows calls using late-binding or run-time method calls.

    This approach allows developer better interop with COM, or, it will enable dynamic languages, like Ruby or Python interoperability. Developers can now use for example Python runtime:

    ScriptRuntime py = Python.CreateRuntime();
    dynamic random = py.UseFile("random.py");
    //Make an array of numbers
    var items = Enumerable.Range(1, 7).ToArray();
    random.shuffle(items);

  3. Named and optional arguments – Allows not to specify argument when not needed or specify argument with a name
    Follows the sample of using optional arguments in C#:

    static void Main(string[] args)
    {
      var testClass = new NewType();
      testClass.OptionalTest();
      testClass.OptionalTest(2,"Privet");
      Console.ReadLine();
    }
    class NewType
    {
      public void OptionalTest(int p1 = 1,
          string s1="Hello") {
        Console.WriteLine(p1 + s1);
      }
    }

    And second example uses optional and named arguments:

    static void Main(string[] args)
    {
      var testClass = new NewType();
      testClass.NamedTest(p1:3, s1:"Grus");
      Console.ReadLine();
    }
    class NewType
    {
      public void NamedTest(int p1 = 1, string s1="Hello") {
        Console.WriteLine(p1 + s1);
      }
    }

  4. Variance – Compiler allows to specify types from type hierarchy in interfaces and typed collections
  5. In-process side by side execution – allows to run multiple framework versions in one process
  6. New class Tuple – type known from functional languages, ordered set of N values can be used to store up to 8 values into one type
  7. Type equivalence support – Embedding PIA (Primary Interop Assemblies) directly In your assembly

 

This is series of articles News in .NET 4 and Visual Studio 2010 release wave

What is new in Visual Studio 2010

News in .NET 4 and Visual Studio 2010 release wave – part four
  1. Application Lifecycle Management platform
    1. Modelling platform “Orcas” with UML support
    2. Architecture explorer – browses whole solution to provide top-bottom overview
    3. image

    4. Call hierarchy – displays all paths to selected code
    5. image

  2. New WPF and Silverlight designers and support for SharePoint and Cloud development
  3. Improvements in Parallel development
  4. IntelliTrace debugging – produces dump files with actual application snapshot to help move appl. state sessions
  5. ASP.NET improvements
    1. Snippets support for HTML, JavaScript with VS 2010
    2. Intellisense for Jscript improvements (faster, support for more JS libraries, XML documentation support) with VS 2010
    3. Simplified Web deployment with VS 2010
    4. Web packages – Creating MSDeploy packages from VS
    5. One Click publish – deployment MSDeploy deployments easily
    6. Web.config transformations – modifiing Web.config for various environments

 

This is series of articles News in .NET 4 and Visual Studio 2010 release wave

What is new in .NET Framework 4.0

News in .NET 4 and Visual Studio 2010 release wave – part two
  1. DLR – Dynamic Language Runtime – new runtime to support dynamic (non statically typed) languages like PHP, Ruby, Python, JavaScript, ..
  2. Parallel programming – Task Library and Plinq to work with parallelism without threads
    1. Software Transactional Memory – Transactions like access to shared memory structures (supports threading) makes parallel programming really easy.
      Sample wihtout of using STM.NET:

      static void Main()
      {
        double myAccount;
        double yourAccount;
        myAccount = 1000;
        yourAccount = 500;
        double amountToTransfer = 150;
        myAccount -= amountToTransfer;
        yourAccount += amountToTransfer;
      }

         
      And the same sample under STM.NET transaction:

      static void Main(string[] args)
      {
          INstmObject<double> myAccount;
          INstmObject<double> yourAccount;
          myAccount = NstmMemory.CreateObject<double>(1000);
          yourAccount = NstmMemory.CreateObject<double>(500);
          using (INstmTransaction tx =
            NstmMemory.BeginTransaction())
          {
             double amountToTransfer = 150;
             myAccount.Write(myAccount.Read() – amountToTransfer);
             yourAccount.Write(yourAccount.Read() +
               amountToTransfer);
             tx.Commit();
          }
         Console.WriteLine("My account balance: {0}",
           myAccount.Read());
         Console.WriteLine("Your account balance: {0}",
           yourAccount.Read());
      }

    2. PLINQ – Parallel LINQ – Linq to objects with parallel extensions to use multiple threads
    3. Task Parallel Library and Coordination Data Structures to better utilize power of multi-processor and multi-core machines. Using parallel Tasks without need to work with threads.
    4. Synchronized colletions (new thread safe collections)
  3. Reactive framework (Linq to events) – New non blocking approach to events
  4. Code Contracts – Run time and Compile time code aspects checking support
  5. WCF 4.0 and WF 4.0 with better support for Web 2.0 technologies like REST, POX, ATOM.
  6. WCF 4.0 improvements
    1. RESTful enhancements – Simplifying the building of REST Singleton & Collection Services, ATOM Feed and Publishing Protocol Services, and HTTP Plain XML Services using WCF
    2. Messaging enhancements
      1. Transports – UDP, MQ, Local in-process
      2. Protocols – SOAP over UDP, WS-Discovery, WS-BusinessActivity, WS-I BP 1.2
    3. Duplex durable messaging
    4. Correlation enhancements
      1. Content and context driven, One-way support
    5. Declarative Workflow Services
      1. Seamless integration between WF and WCF and unified XAML model
      2. Build entire application in XAML, from presentation to data to services to workflow
  7. WF 4.0 Improvements
    1. Declarative Workflow Services
      1. Seamless integration between WF and WCF and unified XAML model
      2. Build entire application in XAML, from presentation to data to services to workflow
    2. Ten-fold improvement in performance
    3. New workflow flow-control models and pre-built activities
      1. Flowcharts, rules
      2. Expanded built-in activities – PowerShell, database, messaging, etc.
      3. Expanded built-in activities – PowerShell, database, messaging, etc.
    4. Enhancements in workflow modeling
      1. Persistence control, transaction flow, compensation support, data binding and scoping
      2. Rules composable and seamlessly integrated with workflow engine
    5. Updated visual designer
      1. Easier to use by end-users
      2. Easier to rehost by ISVs
      3. lity to debug XAML
  8. Complex number – support for computing with complex numbers
  9. System.Device.Location – Getting device geological location – mangitude and longitude, speed, acceleration on Windows 7
  10. Reactive framework (Rx) or Linq to Events – new framework for reacting to events via monades. Uses Observer instead of classical blocking Ienumerable/Iterator pattern for non blocking assynchronous operations.
  11. Stream.CopyTo – method to allow copying from stream to another stream
  12. Guid.TryParse, Version.TryParse and Enum.TryParse – better support for parsing types
  13. Enum.HasFlag – No need to use bit operators to find whether a enum flag is set
  14. Type equivalenceNo need for PIA assemblies at runtime – Compiler takes out needed types from Primary Interop Assemblies and copies them into produced assembly.
  15. Omitting ref – Compiler automatically generates reference types from values when needed to help COM developers out of lot of temporary ref variables.
  16. Variance, Covariance and Contravariance support
  17. Application Server (Dublin) – part of Windows Application Server platform
    1. Provide standard host for WF and WCF applications in IIS
    2. Application Server “Dublin” will initially be made available for download and use by Windows Server customers; later, “Dublin” will be included in future releases of Windows Server.
    3. Application Server “Dublin” will extend Internet Information Services (IIS) to provide a standard host for applications that use workflow or communications.
    4. It will provide support for Oslo modeling platform
    5. It will support existing .NET apps.
    6. It will support integration with BizTalk Server (in this context called "Integration Server").
    7. Pre-built developer services
      1. Message-based correlation
      2. Message forwarding service
      3. Content-based message routing
      4. Compensation service for long-running transactions
      5. Greater scalability and easier manageability
      6. Enable scale-out of stateful workflow applications
      7. Persisting and rehydrating state for high scalability
      8. Enhanced management and monitoring functions
      9. Tracking store for workflow events
  18. Supports “Oslo” modeling platform
  19. ASP.NET 4.0 Enhancements
    1. Web.config clarification (moves elements to machine.config) to minize huge web.config files
    2. AutoStart ASP.NET applications
  20. Automatically starts ASP.NET application without external client hit

 

This is series of articles News in .NET 4 and Visual Studio 2010 release wave

Overview

News in .NET 4 and Visual Studio 2010 release wave – part one

In the release wave of .NET Framework, Visual Studio 2010 will be released with following technologies

  1. .NET Framework 4.0
    1. DLR – Dynamic Language Runtime – new runtime to support dynamic (non statically typed) languages like PHP, Ruby, Python, JavaScript, ..
    2. Parallel programming – Task Library and Plinq to work with parallelism without threads
    3. Reactive framework (Linq to events) – New non blocking approach to events
    4. Code Contracts – Run time and Compile time code aspects checking support
  2. Visual Studio 2010
    1. Modelling with UML support
    2. New WPF and Silverlight designers and support for SharePoint and Cloud development
    3. Improvements in Parallel development
    4. IntelliTrace debugging – produces dump files with actual application snapshot to help move appl. state sessions
  3. C# 4.0
    1. Dynamic keyword to Support for dynamic languages. Dynamic allows to specify non-strict type
    2. Dynamic lookup – makes work with COM Interop calling IDispatch objects, Reflection, HTML objects, etc easy.
    3. Named and optional arguments – Allows not to specify argument when not needed
    4. Variance – Compiler allows to specify types from type hierarchy in interfaces, typed collections and delegates
  4. F# – new functional language with imperative, language and object oriented concepts

 

This is series of articles News in .NET 4 and Visual Studio 2010 release wave