The Hello World version of the program in Nemerle (a C#-like language with functional features) is here!
Could it be a combination of C# and F#? not in the example below, but based on the features it supports it probably is.
By the way, you can see my previous post here: http://carlosqt.blogspot.com/2010/06/oo-hello-world.html
where I give some details on WHY these "OO Hello World series" samples.
By the way, you can see my previous post here: http://carlosqt.blogspot.com/2010/06/oo-hello-world.html
where I give some details on WHY these "OO Hello World series" samples.
Version 1 (Minimal):
The minimum you need to type to get your program compiled and running.
using System; class Greet { mutable name : string; public this(name : string) { this.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1); } public Salute() : void { Console.WriteLine("Hello {0}!", name); } } // Greet the world! def g = Greet("world"); g.Salute();
Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
using System; namespace GreetProgram { internal class Greet { private mutable name : string; public this(name : string) { this.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1); } public Salute() : void { Console.WriteLine("Hello {0}!", this.name); } } // Greet the world! public module GreetProgram { public static Main() : void { def g = Greet("world"); g.Salute(); } } }
The Program Output:
Nemerle Info:
“Nemerle is a high-level statically-typed programming language for the .NET platform. It offers functional, object-oriented and imperative features. It has a simple C#-like syntax and a powerful meta-programming system.
Features that come from the functional land are variants, pattern matching, type inference and parameter polymorphism (aka generics). The meta-programming system allows great compiler extensibility, embedding domain specific languages, partial evaluation and aspect-oriented programming.” Taken from: (http://nemerle.org/What_is_Nemerle)
Appeared:
|
2003
|
Current Version:
|
1.0.0 Beta 2 (latest version in "Languages" page)
|
Developed by:
|
Kamil Skalski, Michal Moskal, Leszek Pacholski and Pawel Olszta
|
Creator:
|
Kamil Skalski, Michal Moskal, Leszek Pacholski and Pawel Olszta
|
Influenced by:
|
C# (Anders Hejlsberg) | Lisp (John McCarthy), ML (Robin Milner)
|
Predecessor Language
| |
Predecessor Appeared
| |
Predecessor Creator
| |
Runtime Target:
|
CLR
|
Latest Framework Target:
|
2.0
|
Mono Target:
|
Yes
|
Allows Unmanaged Code:
|
Yes
|
Source Code Extension:
|
“.n”
|
Keywords:
|
60
|
Case Sensitive:
|
Yes
|
Free Version Available:
|
Yes
|
Open Source:
|
Yes
|
Standard:
|
No
|
Latest IDE Support:
|
Visual Studio 2008 (shell, pro)
MonoDevelop 2.2
|
Language Reference:
| |
Extra Info:
|
1. It language also influenced by Lisp (macro system) and ML (functional feature).
ReplyDelete2. Nemerle support script-like syntax. You can omit "module ... Main()".
Nemerle OO Hellow World 1:
ReplyDeleteusing System.Console;
class Greet
{
mutable name : string;
public this(name : string)
{
this.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1);
}
public Salute() : void
{
WriteLine($"Hello $name!");
}
}
def g = Greet("world");
g.Salute();
The same example with indentation syntax:
ReplyDelete#pragma indent
using System.Console;
class Greet
mutable name : string;
public this(name : string)
this.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1);
public Salute() : void
WriteLine($"Hello $name!");
def g = Greet("world");
g.Salute();
@VladD2
ReplyDeleteThanks for your remarks!
You right, I missed the scripting support feature. I updated Version 1 to use "script-like syntax".
Also updated the Inspired by in the Info table.
Thanks again!