Nemerle is Notable

  • View

  • Download

Embed Size (px)


My presentation about Nemerle language on

Text of Nemerle is Notable

  • 1.Nemerle is notable Nemerle is notable Denis rystsov.denis@gmail.com2011

2. Nemerle is notableOrigin 3. Nemerle is notableNemerle Experience 4. Nemerle is notableEnvironmentManaged compiler written in NemerleVisual Studio 2008 plugin with debugger and autocompleteFree IDE based on Visual Studio Isolated ShellSharpdevelop pluginMono supportNAnt plugin 5. Nemerle is notableWhy not try?Nemerle is almost a superset ofC#, so if you know C# you canuse Nemerle. 6. Nemerle is notableWhy not try?By the way, Nemerles compilercan compile C# code, so youcan try it on exising C# project 7. Nemerle is notableWhy not try?Why not try? 8. Nemerle is notablePart I - use your C# habitsPart I - use your C# habits 9. Nemerle is notableHello world / C# 10. Nemerle is notableHello world / Nemerle 11. Nemerle is notableExtension Methods / C# 12. Nemerle is notableExtension Methods / Nemerle 13. Nemerle is notableLINQ / C# 14. Nemerle is notableLINQ / Nemerle 15. Nemerle is notableObject Initialization / C# 16. Nemerle is notableObject Initialization / Nemerle 17. Nemerle is notableAnonymous Types / C# 18. Nemerle is notableAnonymous Types / Nemerle 19. Nemerle is notableYield return / C# 20. Nemerle is notableYield return / Nemerle 21. Nemerle is notableDynamic / C# 22. Nemerle is notableDynamic / Nemerle 23. Nemerle is notableType casting / C# 24. Nemerle is notableType casting / Nemerle 25. Nemerle is notableTry..Catch / C# 26. Nemerle is notableTry..Catch / Nemerle 27. Nemerle is notablePartial / C# 28. Nemerle is notablePartial / Nemerle 29. Nemerle is notableArrays / C# 30. Nemerle is notableArrays / Nemerle 31. Nemerle is notableAttention! Wild dinosaur! 32. Nemerle is notableGoto?What is about..GOTO?unlike C# Nemerle doesnt support it, but.. 33. Nemerle is notableThe proper use of gotoThe only one legal usage of goto isexit from nested loopsNemerle provides a bettersolutionnamed code blocks 34. Nemerle is notableNamed code blocks 35. Nemerle is notableBeyond C#After this short intro you canwrite apps in Nemerle in C#style.But Nemerle goes far beyond it 36. Nemerle is notableDesired C# featuresItsupportsthe most desiredfeatures of the nextversions of C# right now 37. Nemerle is notablePart II - desired C# featuresPart II - desired C# features 38. Nemerle is notableObject initializers with events 39. Nemerle is notablePainless XML generation 40. Nemerle is notableINotifyPropertyChanged language support 41. Nemerle is notable`Safe navigation operator 42. Nemerle is notableDesign by contract 43. Nemerle is notableSequence initialization (list comprehension) 44. Nemerle is notableYield from lambda 45. Nemerle is notableImproved lazy support 46. Nemerle is notablePart IIIfunctional programmingPart IIIfunctionalprogramming (FP) 47. Nemerle is notableWhat is FP?Typical signs of FPMonadsType inferencePattern matchingAlgebraic data typesBuilt-in tuple supportLocal (nested) functions 48. Nemerle is notableNemerle supports FPNemerle supports it all 49. Nemerle is notableType inference 50. Nemerle is notableLocal functions 51. Nemerle is notableBuilt-in tuple support 52. Nemerle is notableMonadsMonad is creational functional programming designpattern that deals with computation creation.The upcoming C# 5 async/await feature is particularcase of a monad (creation of asynchronouscomputation).Computation expressions are monads + monoids.Nemerle supports computation expressions. 53. Nemerle is notableMonadsConsequently Nemerle supportsthe upcoming C# 5async/await feature right nowamong the other monads. 54. Nemerle is notableExample of easy composition of two async methods 55. Nemerle is notableAlgebraic data typesShort intro toalgebraic data types 56. Nemerle is notableAlgebraic data typesLets learn ADT by exampleSuppose we need to work withexpressions like a + sin(b) 57. Nemerle is notableAlgebraic data typeOf couse we need trees 58. Nemerle is notableOOP approach to trees (class hierarchy) 59. Nemerle is notableFP approach to trees (ADT - algebraic data type) 60. Nemerle is notableAlgebraic data typesemanticAfter we rewrite OOP code with variant (ADT) weshould consider`Sum as a constructor of type `Tree`l,`r as its params (not a Tree.Sums elds)But if they are params, how get them back from a`Tree typed object? 61. Nemerle is notableAlgebraic data typeDisassembling (pattern matching)Pattern matching solves this problem. It checks if object isconstructed with constructor specied in a pattern and if it is trueit binds actual parameters of constructor with names of variablesthe pattern.Lets see on the following example. 62. Nemerle is notablePretty Printing of `Tree typed object 63. Nemerle is notableAlgebraic data typeOOP vs. FPOOP72 SLoC (pretty printing withvisitor pattern)FP25 SLoC (pretty printing withpattern matching) 64. Nemerle is notableVariant is OOP enabled algebraic data type 65. Nemerle is notablePattern matching goes beyond disassemblingPattern matching can be nested. 66. Nemerle is notableAlmost all features are macrosNemerle seems to be complex,but. . . 67. Nemerle is notableAlmost all Nemerle features are macrosDont worryNemerle is a simple language and almost all features aremacrosparts of standard library, not a language.Macros is a plugin to compiler. You can write your ownmacros to introduce new language constructs or eDSL. 68. Nemerle is notableAlmost all Nemerle features are macrosYouve already meet macros inthis presentation, they are. . . 69. Nemerle is notableAlmost all Nemerle features are macrosLINQ Object initialization Anonymous typesLate (dynamic) XML-LiteralsINotifyPropertyChanged macro Safe navigationDesign by contract Computation expressionsLazy macroand evenif while foreach 70. Nemerle is notableAdvanced macrosBeside macros copying useful features from anotherlanguages there are macros adding unique features.One of them is Nemerle.Peg. It is a macro-librarythat allows to describe grammar in the attribute andduring the compilation necessary methods for parsingtext in this grammar will be added to the class.Also there are some macros supporting designpatterns. 71. Nemerle is notableNemerle is coolNemerle is cool.It was proved. 72. Nemerle is notableMetricSome metric of using Nemerlein home pet long-term formula searchengine 73. Nemerle is notableMetricTwo years ago rst prototype was rewritten from C# toNemerle 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 notableAdditional materialsNemerle on google codeNemerle siteSources code of examples shown in this presentation