4. Nemerle is notable
Environment
Managed compiler written in Nemerle
Visual Studio 2008 plugin with debugger and autocomplete
Free IDE based on Visual Studio Isolated Shell
Sharpdevelop plugin
Mono support
NAnt plugin
5. Nemerle is notable
Why not try?
Nemerle is almost a superset of
C#, so if you know C# you can
use Nemerle.
6. Nemerle is notable
Why not try?
By the way, Nemerle's compiler
can compile C# code, so you
can try it on exising C# project
33. Nemerle is notable
The proper use of goto
The only one legal usage of goto is
exit from nested loops
Nemerle provides a better
solution named code blocks
47. Nemerle is notable
What is FP?
Typical signs of FP
Monads
Type inference
Pattern matching
Algebraic data types
Built-in tuple support
Local (nested) functions
52. Nemerle is notable
Monads
Monad is creational functional programming design
pattern that deals with computation creation.
The upcoming C# 5 async/await feature is particular
case of a monad (creation of asynchronous
computation).
Computation expressions are monads + monoids.
Nemerle supports computation expressions.
53. Nemerle is notable
Monads
Consequently Nemerle supports
the upcoming C# 5
async/await feature right now
among the other monads.
60. Nemerle is notable
Algebraic data type semantic
After we rewrite OOP code with variant (ADT) we
should consider
`Sum' as a constructor of type `Tree'
`l',`r' as its params (not a Tree.Sum's elds)
But if they are params, how get them back from a
`Tree' typed object?
61. Nemerle is notable
Algebraic data type Disassembling (pattern matching)
Pattern matching solves this problem. It checks if object is
constructed with constructor specied in a pattern and if it is true
it binds actual parameters of constructor with names of variables
the pattern.
Let's see on the following example.
63. Nemerle is notable
Algebraic data type OOP vs. FP
OOP
72 SLoC (pretty printing with
visitor pattern)
FP
25 SLoC (pretty printing with
pattern matching)
67. Nemerle is notable
Almost all Nemerle features are macros
Don't worry
Nemerle is a simple language and almost all features are
macros parts of standard library, not a language.
Macros is a plugin to compiler. You can write your own
macros to introduce new language constructs or eDSL.
68. Nemerle is notable
Almost all Nemerle features are macros
You've already meet macros in
this presentation, they are. . .
69. Nemerle is notable
Almost all Nemerle features are macros
LINQ Object initialization Anonymous types
Late (dynamic) XML-Literals
INotifyPropertyChanged macro Safe navigation
Design by contract Computation expressions
Lazy macro
and even
if while foreach
70. Nemerle is notable
Advanced macros
Beside macros copying useful features from another
languages there are macros adding unique features.
One of them is Nemerle.Peg. It is a macro-library
that allows to describe grammar in the attribute and
during the compilation necessary methods for parsing
text in this grammar will be added to the class.
Also there are some macros supporting design
patterns.
72. Nemerle is notable
Metric
Some metric of using Nemerle
in home pet long-term research
project
uniquation.com formula search
engine
73. Nemerle is notable
Metric
Two years ago rst prototype was rewritten from C# to
Nemerle in 3 days. Nemerle experience before 0.
Code was reduced by 46%.
Last month a new macro library (Nemerle.Peg) was applyed.
Code was reduced by 15%.
74. Nemerle is notable
Additional materials
Nemerle on google code
Nemerle site
Sources code of examples shown in this presentation