Saturday, June 26, 2010

OO Hello World - IronRuby



Let’s have a look at the hello world program in IronRuby; another language implemented to run on the DLR runtime.

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.
class Greet
 @name = ""
 def initialize(name)
  @name = name.capitalize
 end
 def salute
  puts "Hello #@name!"
 end
end

# Greet the world!
g = Greet.new("world")
g.salute


Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
require "mscorlib"

module GreetProgram 
 class Greet
  @name = ""
  def initialize(name)
   @name = name.capitalize
  end
  def salute
   puts "Hello #@name!"
  end
 end
 
 # Greet the world!
 g = Greet.new("world")
 g.salute  
end


The Program Output:










IronRuby Info:
“IronRuby is an Open Source implementation of the Ruby programming language for .NET, heavily relying on Microsoft's Dynamic Language Runtime.” Taken from: (http://www.ironruby.net/)

Appeared:
2007
Current Version:
Developed by:
John Lam + DLR Team
Creator:
John Lam
Influenced by:
Ruby (Yukihiro Matsumoto)
Predecessor Language
RubyCLR?
Predecessor Appeared
2006
Predecessor Creator
John Lam
Runtime Target:
DLR
Latest Framework Target:
4.0
Mono Target:
Yes
Allows Unmanaged Code:
No
Source Code Extension:
“.rb”
Keywords:
38
Case Sensitive:
Yes
Free Version Available:
Yes
Open Source:
Yes
Standard:
No
Latest IDE Support:
SharpDevelop 3.2/4.0 (beta)
Language Reference:
Extra Info:


Wednesday, June 23, 2010

OO Hello World - IronPython



Let’s have a look at the hello world program in IronPython; the first language to run on the DLR runtime.

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.

class Greet(object): 
 name = ''
 def __init__(self, name):
  self.name = name.capitalize()
 def salute(self):
  print 'Hello ', name, '!'

# Greet the world!
g = Greet('world')
g.salute()

Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.

import System

class Greet(object): 
 name = ''
 def __init__(self, name):
  self.name = name.capitalize()
 def salute(self):
  print 'Hello ', self.name, '!'

# Greet the world!
def main():
 g = Greet('world')
 g.salute()
 
main()

The Program Output:









IronPython Info:
“IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code just as easily.” Taken from: (http://www.ironpython.net/)

Appeared:
2006
Current Version:
Developed by:
Jim Hugunin
Creator:
Jim Hugunin
Influenced by:
Python (Guido van Rossum)
Predecessor Language
Predecessor Appeared
Predecessor Creator
Runtime Target:
DLR
Latest Framework Target:
4.0
Mono Target:
Yes
Allows Unmanaged Code:
Yes
Source Code Extension:
“.py”
Keywords:
31
Case Sensitive:
Yes
Free Version Available:
Yes
Open Source:
Yes
Standard:
No
Latest IDE Support:
Visual Studio 2010 (pro, shell, etc + IronPython Tools)
SharpDevelop 3.2/4.0 (beta)
MonoDevelop 2.2
Language Reference:
Extra Info:

Saturday, June 19, 2010

OO Hello World - Phalanger



Phalanger version of the OO Hello World is here!
Phalanger is a PHP compiler targeting the .NET CLR. It allows you to create any type of .net applications, not only Web apps, but also console, windows forms, and libraries using the PHP language and libraries.

If you are new to the PHP programming language you can go to the Phalanger Info section.


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.
<?
class Greet 
{
    private $name;
    function __construct($name)
    {    
        $this->name = ucwords($name);
    }
    function Salute()
    {
        echo "Hello {$this->name}!";        
    }
}

// Greet the world!
class Program
{
    static function Main()
    {                    
        $g = new Greet("world");
        $g->Salute();
    }
}
?>

Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
<?php
import namespace System;
namespace GreetProgram
{   
    [Export] 
    class Greet 
    {
        private $name;
        public function __construct($name)
        {
            $this->name = ucwords($name);
        }
        public function Salute()
        {
            echo "Hello {$this->name}!";
        }
    }

    // Greet the world!
    class Program
    {
        public static function Main()
        {                    
         $g = new GreetProgram:::Greet("world");
         $g->Salute();         
        }
    }
}
?>

The Program Output:










Phalanger Info:

“Phalanger is a project which was started at Charles University in Prague and was supported by Microsoft. It compiles source code written in the PHP scripting language into CIL byte-code. It handles the beginning of a compiling process which is completed by the JIT compiler component of the .NET Framework. It does not address native code generation nor optimization. Its purpose is to compile PHP scripts into .NET assemblies, logical units containing CIL code and meta-data. Phalanger can run real-world PHP applications, many with minor to no modifications.” Taken from: (http://en.wikipedia.org/wiki/Phalanger_(compiler))

Appeared:
2003
Current Version:
Developed by:
Tomas Matousek, Ladislav Prosek, Vaclav Novak, Pavel Novak, Jan Benda, and Martin Maly
Creator:
Tomas Matousek, Ladislav Prosek
Influenced by:
PHP (Rasmus Lerdorf)
Predecessor Language
Predecessor Appeared
Predecessor Creator
Runtime Target:
CLR
Latest Framework Target:
2.0
Mono Target:
Yes
Allows Unmanaged Code:
No
Source Code Extension:
“.php”
Keywords:
92
Case Sensitive:
No
Free Version Available:
Yes
Open Source:
Yes
Standard:
No
Latest IDE Support:
Visual Studio 2008 (pro, shell)
Language Reference:
Extra Info:


OO Hello World - Boo



Hello world in Boo is here as well.
"Boo is a new object oriented statically typed programming language for the Common Language Infrastructure with a python inspired syntax and a special focus on language and compiler extensibility." Taken from: (http://boo.codehaus.org/)


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.
class Greet: 
 name as string
 def constructor(name as string):
  self.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1)
 def Salute():
  print "Hello, ${name}!"

// Greet the world!
g = Greet("world")
g.Salute()
Version 2 (Verbose):
Explicitly adding instructions and keywords that are optional to the compiler.
namespace GreetProgram
import System

private class Greet: 
 private name as string
 public def constructor(name as string):
  self.name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1)
 public def Salute():
  print "Hello, ${self.name}!"

// Greet the world!
public def Main(argv as (string)):
 g = Greet("world")
 g.Salute()


The Program Output:
  








Boo Info:
Boo is an object oriented, statically typed programming language that seeks to make use of the Common Language Infrastructure's support for Unicode, internationalization and web applications, while using a Python-inspired syntax[1] and a special focus on language and compiler extensibility. Some features of note include type inference, generators, multimethods, optional duck typing, macros, true closures, currying, and first-class functions.” Taken from: (http://en.wikipedia.org/wiki/Boo_(programming_language))

Appeared:
2003
Current Version:
Developed by:
Rodrigo B. De Oliveira
Creator:
Rodrigo B. De Oliveira
Influenced by:
Python (Guido van Rossum)
Predecessor Language
Predecessor Appeared
Predecessor Creator
Runtime Target:
CLR
Latest Framework Target:
3.5
Mono Target:
Yes
Allows Unmanaged Code:
Yes
Source Code Extension:
“.boo”
Keywords:
66
Case Sensitive:
Yes
Free Version Available:
Yes
Open Source:
Yes
Standard:
No
Latest IDE Support:
SharpDevelop 3.2/4.0 (beta)
MonoDevelop 2.2
Language Reference:
Extra Info: