FACTOID # 3: Andorrans live the longest, four years longer than in neighbouring France and Spain.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RELATED ARTICLES
People who viewed "Nemerle" also viewed:
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Nemerle
Nemerle
Paradigm: multi-paradigm: functional, object-oriented, imperative
Designed by: Kamil Skalski, Michał Moskal, Prof. Leszek Pacholski and Paweł Olszta at Wrocław University
Typing discipline: static, strong, inferred
Major implementations: Nemerle
Influenced by: C#, ML

Nemerle is a high-level statically-typed programming language for the .NET (see also Mono) platform. It offers functional, object-oriented and imperative features. It has a simple C#-like syntax and a powerful metaprogramming system. A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ... This does not cite any references or sources. ... Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. ... Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and computer programs. ... In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ... The main building of Wrocław University, seen from the University bridge (Most Uniwersytecki) spanning the Oder River. ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... On computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. ... In computing, strongly-typed, when applied to a programming language, is used to describe how the language handles datatypes. ... Type inference is a feature present in some strongly statically typed programming languages. ... Look up Implementation in Wiktionary, the free dictionary. ... The title given to this article is incorrect due to technical limitations. ... ML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at the University of Edinburgh, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactics in the LCF theorem prover (the language of... A high-level programming language is a programming language that is more user-friendly, to some extent platform-independent, and abstract from low-level computer processor operations such as memory accesses. ... On computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. ... A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. ... Microsoft . ... Mono is a project led by Novell (formerly by Ximian) to create an Ecma standard compliant . ... Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. ... Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. ... In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ... The title given to this article is incorrect due to technical limitations. ... Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data or that do part of the work during compile time that is otherwise done at run time. ...


It has been named after the archmage Nemmerle from "A Wizard of Earthsea" by Ursula K. Le Guin (spelling with a single m is a design decision). A Wizard of Earthsea, first published in 1968, is the first of a series of books written by Ursula K. Le Guin and set in her fantasy archipelago of Earthsea. ... Ursula Kroeber Le Guin [ˌɜɹsələ ˌkɹobɜɹ ləˈgWɪn] (born October 21, 1929) is an American author. ...

Contents

Features

Probably the most important feature of Nemerle is the ability to mix object oriented and functional programming styles. The top-level program structure is object oriented, while in the body of methods one can (but is not forced to) use functional style. This is very handy in some programming problems. The feature set here include functional values, variants and pattern matching. In computer science, object-oriented programming, OOP for short, is a computer programming paradigm. ... Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. ... In object-oriented programming there are two notions of delegation. ... In functional programming, new types can be defined, each of which has one or more constructors. ... In computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. ...


Another very important feature is taking a high-level approach in all aspects of the language—trying to lift as much of the burden from the programmer as possible. Features like macros and type inference fit here. A high-level programming language is a programming language that is more user-friendly, to some extent platform-independent, and abstract from low-level computer processor operations such as memory accesses. ... Metaprogramming is the writing of computer programs that write or manipulate other programs (or themselves) as their data or that do part of the work during compile time that is otherwise done at run time. ... Type inference is a feature present in some strongly statically typed programming languages. ...


Features that come from the functional land are variants (aka algebraic data types), pattern matching, type inference and parameter polymorphism (aka generics). The metaprogramming system allows great compiler extensibility, embedding domain specific languages, partial evaluation and aspect-oriented programming. In functional programming, new types can be defined, each of which has one or more constructors. ... In computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. ... Type inference is a feature present in some strongly statically typed programming languages. ... Generic programming is a style of computer programming where algorithms are written in an extended grammar and are made adaptable by specifying variable parts that are then somehow instantiated later by the compiler with respect to the base grammar. ... A diagram of the operation of a typical multi-language, multi-target compiler. ... In computing, partial evaluation is a technique for program optimization by specialization. ... In software engineering, the programming paradigm of aspect-oriented programming (AOP), also called aspect-oriented software development (AOSD), attempts to aid programmers in the separation of concerns, or the breaking down of a program into distinct parts that overlap in functionality as little as possible. ...


Last but not least, the usage of more mundane library stuff from the .NET is as easy as (or easier than) in C#. Microsoft . ...


Examples

Hello, World!

The traditional "Hello World!" can be implemented in a more C#-like fashion: A hello world program is a computer program that prints out Hello, World! on a display device. ...

 class Hello { static Main () : void { System.Console.WriteLine ("Hello, world!"); } } 

or more simply:

 System.Console.WriteLine("Hello, world!"); 

Examples of macros

Macros allow you to have boilerplate code generated for you under the hood, with additional static checks performed by the compiler. They give you the power to programatically generate code.


Database accessibility

For example, using Nemerle macros for SQL you can write:

 ExecuteReaderLoop ("SELECT firstname, lastname FROM employee WHERE firstname = $myparm", dbcon, { System.Console.WriteLine ("Name: {0} {1}", firstname, lastname) }); 

instead of

 string sql = "SELECT firstname, lastname FROM employee WHERE firstname = :a"; NpgsqlCommand dbcmd = new NpgsqlCommand (sql, dbcon, dbtran); dbcmd.Parameters.Add("a", myparm); NpgsqlReader reader = dbcmd.ExecuteReader(); while(reader.Read()) { string firstname = reader.GetString (0); string lastname = reader.GetString (1); System.Console.WriteLine ("Name: {0} {1}", firstname, lastname) } reader.Close(); dbcmd.Dispose(); 

and this is not just hiding some operations into a library, but additional work performed by compiler to understand the query string, variables used there, and columns returned from the database. The ExecuteReaderLoop macro will generate code roughly equivalent to what you would have to type manually. Moreover, it connects to the database at compilation time to check that your SQL query really makes sense.


New language constructs

With Nemerle macros you can also introduce some new syntax into the language:

 macro ReverseFor (i, begin, body) syntax ("ford", "(", i, ";", begin, ")", body) { <[ for ($i = $begin; $i >= 0; $i--) $body ]> } 

defines a macro introducing the ford (EXPR ; EXPR) EXPR syntax and can be used like

 ford (i ; n) print (i); 

Nemerle with ASP.NET

Nemerle can be either embedded directly into ASP.NET:

 <%@ Page Language="Nemerle" %> <script runat="server"> Page_Load(_ : object, _ : EventArgs) : void { Message.Text = $"You last accessed this page at: $(DateTime.Now)"; } EnterBtn_Click(_ : object, _ : EventArgs) : void { Message.Text = $"Hi $(Name.Text), welcome to ASP.NET!"; } </script> <html> <body> <form runat="server"> Please enter your name: <asp:TextBox ID="Name" runat="server" /> <asp:Button OnClick="EnterBtn_Click" Text="Enter" runat="server" /> <p><asp:Label ID="Message" runat="server" /></p> </form> </body> </html> 

...Or stored in a separate file and entered with a single line:

 <%@ Page Language="Nemerle" Src="test.n" Inherits="Test" %> 

PInvoke

Nemerle can take advantage of native platform libraries. The syntax is very similar to C#'s and other .NET languages. Here is the simplest example: Microsoft . ...

 using System; using System.Runtime.InteropServices; class PlatformInvokeTest { [DllImport("msvcrt.dll")] public extern static puts(c : string) : int; [DllImport("msvcrt.dll")] internal extern static _flushall() : int; public static Main() : void { _ = puts("Test"); _ = _flushall(); } } 

See also

  • Boo - another object oriented, statically typed programming language for the .NET framework, similar to Python.

Boo is an object oriented, statically typed programming language developed starting in 2003, which seeks to make use of the Common Language Infrastructure support for Unicode, globalization and web style applications, while using a Python-inspired syntax and a special focus on language and compiler extensibility. ... Python is a high-level programming language first released by Guido van Rossum in 1991. ...

External links

  • Language Homepage
  • The official documentation
  • Nemerle at 99 Bottles of Beer
  • Interesting entries about Nemerle from akiramei's diary (in Japanese)

  Results from FactBites:
 
Encyclopedia: Nemerle (610 words)
Nemerle is a hybrid functional Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions.
These sublanguages should ideally by checked syntactically and semantically at compile-time as much as possible, and one may like to be able to have the embedded language's as primitives as first-class in the "parent" language, without resorting to cumbersome library calls all the time.
Nemerle's macro system seems to be powerful enough to do this, and only experience will tell if it's worthwhile in a language with complex syntax.
Nemerle - Encyclopedia, History, Geography and Biography (677 words)
Nemerle is a high-level statically-typed programming language for the.NET (see also Mono) platform.
Probably the most important feature of Nemerle is the ability to mix object oriented and functional programming styles.
Nemerle, Features, Examples, Hello, World!, Examples of macros, Database accessibility, New language constructs, Nemerle with ASP.NET, PInvoke, External links, Programming languages, Functional languages, Imperative programming languages,.NET programming languages, Object-oriented programming languages and ML programming language family.
  More results at FactBites »


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 0927, e