Neko (programming language)


Neko (programming language)
Neko
NekoLogo.png
Paradigm(s) object-oriented, structured, classless, scripting
Appeared in 2005
Developer Nicolas Cannasse
Stable release 1.8.1 (July 26, 2009)
Typing discipline dynamic
Major implementations Neko, haXe
OS Cross-platform
Usual filename extensions .neko
Website nekovm.org

Neko is a high-level dynamically typed programming language developed by Nicolas Cannasse as part of R&D efforts at Motion-Twin.

Contents

Concept

Neko has a compiler and a virtual machine with garbage collection. The compiler converts a source .neko file into a bytecode .n file that can be executed with the virtual machine. Since Neko is dynamically typed with no fixed classes, a developer only has to find the proper runtime mapping (as opposed to type mapping) so that code executes correctly. As the Neko FAQ puts it: "...it is easier to write a new or existing language on the NekoVM than it is for the CLR / JVM, since you don’t have to deal with a highlevel type system. Also, this means that languages can interoperate more easily since they only need to share the same data structures and not always the same types."[1]

Neko requires compilation before execution, like other scripting languages such as Groovy. Since Neko doesn't need to be interpreted at runtime, it executes faster. The haXe programming language compiles to Neko code, among other targets.

Examples

Hello World

$print("Hello World!");

Type conversions

$int("67.87"); // Converts string "67.87" to integer 67
$float(12345); // Converts integer 12345 to float 12345.0000
$string($array(1,2,3)); // Converts array [1,2,3] to string "[1,2,3]"

Objects

o = $new(null); // new empty object
o2 = $new(o); // makes a copy of o
o2 = $new(33); // if parameter is not an object, throw an exception
o.field = value; //sets field to value
o.field; // returns "field" value of object o

Methods

foo = function() {
        $print(this.x);
}
o = $new(null);
o.x = 3;
o.bar = function() { 
        foo(); 
};
o.bar(); // prints 3

Function scope

var x = 3;
f = function() {
        $print(x);
}
x = 4;
f(); // print 3

Prototypes

var proto = $new(null);
proto.foo = function() { 
$print(this.msg) }
 
var o = $new(null);
o.msg = "hello";
$objsetproto(o,proto);
o.foo(); // print "hello"
 
$objsetproto(o,null); // remove proto
o.foo(); // exception

Web functionality

Neko includes a mod_neko module for the Apache server. As such, it can process user input using GET and POST requests:

get_params = $loader.loadprim("mod_neko@get_params",0);
$print("PARAMS = "+get_params());

References

  1. ^ "How is Neko different from .Net's CLR or the Java's JVM ?". Neko FAQ. http://nekovm.org/faq#how_is_neko_different_from_.net_s_clr_or_the_java_s_jvm. Retrieved 9 January 2011. 

External links


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Neko — is the Japanese word for cat and may refer to: Technology Neko (computer program), a cat screenmate application Neko (programming language) Neko Entertainment, a video game developer and publisher Other uses Neko (cosplay), a person who enjoys… …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Prototype-based programming — is a style of object oriented programming in which classes are not present, and behavior reuse (known as inheritance in class based languages) is performed via a process of cloning existing objects that serve as prototypes. This model can also be …   Wikipedia

  • Procedural programming — can sometimes be used as a synonym for imperative programming (specifying the steps the program must take to reach the desired state), but can also refer (as in this article) to a programming paradigm based upon the concept of the procedure call …   Wikipedia

  • Virtual machine — A virtual machine (VM) is a completely isolated guest operating system installation within a normal host operating system .[1] Modern virtual machines are implemented with either software emulation or hardware virtualization or (in the most… …   Wikipedia

  • HaXe — Infobox programming language name = haXe paradigm = object oriented, structured, scripting year = 2005 developer = Nicolas Cannasse latest release version = 2.0 typing = static operating system = Cross platform website = [http://haxe.org/… …   Wikipedia

  • Comparison of application virtual machines — This article lists some software virtual machines that are typically used for allowing application bytecode to be portably run on many different computer architectures and operating systems. The application is usually run on the computer using an …   Wikipedia

  • Liste des langages de programmation — Le but de cette Liste des langages de programmation est d inclure tous les langages de programmation existants, qu ils soient actuellement utilisés ou historiques, par ordre alphabétique. Ne sont pas listés ici les langages informatiques de… …   Wikipédia en Français

  • Liste von Hallo-Welt-Programmen/Sonstige — Dies ist eine Liste von Hallo Welt Programmen für grafische Benutzeroberflächen, Web Technologien, exotische Programmiersprachen und Textauszeichnungssprachen. Weitere Beispiele für gebräuchliche Programmiersprachen sind unter Liste von Hallo… …   Deutsch Wikipedia

  • Dragon Ball — Dragon Boy redirects here. For the unrelated Canadian television series, see Dragon Boys. This article is about the media franchise. For other uses, see Dragon Ball (disambiguation). Dragon Ball …   Wikipedia