Kaya (programming language)
Encyclopedia
Kaya is a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 with a powerful type system, static type checking and type inference
Type inference
Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction....

.

Overview

Kaya is a compiled language
Compiled language
A compiled language is a programming language whose implementations are typically compilers , and not interpreters ....

 with a powerful and unobtrusive type system, allowing many bugs to be found at compile time. Type inference
Type inference
Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction....

 means that the need to explicitly write types down is minimised, while polymorphic records and functions, together with ad-hoc function overloading, allow easy writing of general functions.

Kaya allows functions to be partially applied, with the remaining parameters completed later. This allows easy development of generalised functions, evaluation of expensive functions to be postponed until necessary, and separation of program code into logical chunks to be done without sacrificing efficiency. Anonymous functions (lambda functions) are also supported.

Kaya includes extensive pattern matching
Pattern matching
In computer science, pattern matching is the act of checking some sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact. The patterns generally have the form of either sequences or tree structures...

 capabilities, allowing analysis of complex data structures and extraction of needed variables to be expressed more readably than via a sequence of nested if statements. Complex data types may be aliased to type synonyms, to improve the readability of code, and to allow for implementation changes.

There are several primitive types, including automatically sized multi-dimensional arrays.
There is a large standard library containing modules for processing user input, database access with a cross-database API, image generation with libgd, regular expressions and many features for web development.

Implementation

Kaya is cross-platform, available for Linux, Mac OS X and Windows, and should work on any other POSIX-compliant system. Programs written in Kaya can be compiled on any of these operating systems, and can run on a wide variety of hardware architectures.

Other features

  • Automatic garbage collection via libgc
  • Foreign functions interface to call C libraries
  • Exception handling
  • A module system
  • Usable as a scripting language with '#!
    Shebang (Unix)
    In computing, a shebang is the character sequence consisting of the characters number sign and exclamation point , when it occurs as the first two characters on the first line of a text file...

    ' line

Examples

Hello world:


program hello;

Void main {
// My first program!
putStrLn("Hello world!");
}


A Simple Web Application:


webapp webhello;

import Webapp;
import HTMLDocument;

HTMLDocument webmain {
doc = HTMLDocument::new(HTML4Strict,"Hello Web!");
h1 = addHeading(doc.body,1,"Hello Web!");

return doc;
}
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK