Tuesday, August 31, 2010

INO301 Code Different

Speaker: Ivan Towlson

C# and Visual Basic reconsidered
- Imperative
- Textual
- No extensibility mechanisms
- Minimal abstraction over the underlying machine

The assembly languages of the CLR

F#
- A functional-object hybrid
- Included in Visual Studio 2010
- A CLR language

You can call C# or Visual Basic components from F#
You can call F# components from C# or Visual Basic

F# Features With C#/VB Equivalents

First class functions
Similar to .NET delegates 

Lambdas and closures
Similar to C# lambdas Type inference

Similar to C# var, but used much more extensively
You rarely have to write explicit type annotations in F#

Comprehensions
Similar to LINQ

Quotations
Similar to expression trees

F# Idioms

Emphasis on functions rather than records

Rich data type support: options, tuples, discriminated unions
Pattern matching

Immutable by default

Helps with asynchronous and parallel programming
“Expressions that have values” instead of “statements that perform actions”

F# Interactive REPL
Try out your code as you go (tip: Alt+Enter!)

F# Features

Asynchronous workflows and agents

Example: parallel or cloud computing interop Starcraft

Computation expressions

Customising how a sequence of expressions is executed

Parser generator

Example: simple macro or expression languages

Units of measure

Example: scientific or financial computation