Go! (programming language)
Encyclopedia
Go! is an agent-based programming language in the tradition of logic-based programming
Logic programming
Logic programming is, in its broadest sense, the use of mathematical logic for computer programming. In this view of logic programming, which can be traced at least as far back as John McCarthy's [1958] advice-taker proposal, logic is used as a purely declarative representation language, and a...

 languages like Prolog
Prolog
Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of...

. It was introduced in a 2003 paper by Francis McCabe and Keith Clark
Keith Clark
Keith L. Clark is a Professor of Computer Science at Imperial College London, England. He has lectured in both mathematics and computer science. Since 1979 he has had a tenured position in the Department of Computing, Imperial College London, where he has been Professor of Computational Logic...

.

Upon the November 2009 release of Google's Go programming language
Go (programming language)
Go is a compiled, garbage-collected, concurrent programming language developed by Google Inc.The initial design of Go was started in September 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. Go was officially announced in November 2009. In May 2010, Rob Pike publicly stated that Go was being...

 (note lack of exclamation point), McCabe asked Google to change the name of their language and accused the company of "steam-rolling over us". The issue received attention among technology news websites, with some of them characterizing Go! as "obscure".

Design

The authors of Go! describe it as "a multi-paradigm programming language
Multi-paradigm programming language
Programming languages can be grouped by the number and types of paradigms supported.-Paradigm summaries:A concise reference for the programming paradigms listed in this article....

 that is oriented to the needs of programming secure, production quality, agent based applications. It is multi-threaded, strongly typed and higher order (in the functional programming sense). It has relation, function and action procedure definitions. Threads execute action procedures, calling functions and querying relations as need be. Threads in different agents communicate and coordinate using asynchronous messages. Threads within the same agent can also use shared dynamic relations acting as Linda
Linda (coordination language)
In computer science, Linda is a model of coordination and communication among several parallel processes operating upon objects stored in and retrieved from shared, virtual, associative memory...

-style tuple stores
Tuple space
A tuple space is an implementation of the associative memory paradigm for parallel/distributed computing. It provides a repository of tuples that can be accessed concurrently. As an illustrative example, consider that there are a group of processors that produce pieces of data and a group of...

."

The authors also propose that the language is suitable for representing ontologies due to its integration of logic
Logic programming
Logic programming is, in its broadest sense, the use of mathematical logic for computer programming. In this view of logic programming, which can be traced at least as far back as John McCarthy's [1958] advice-taker proposal, logic is used as a purely declarative representation language, and a...

, functional
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 and imperative
Imperative programming
In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...

 styles of programming.

As a deliberate design choice to reduce complexity, Go! does not support inheritance
Inheritance (object-oriented programming)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

. Thus, it is an object-based language
Object-based language
The term "object-based language" may be used in a technical sense to describe any programming language that uses the idea of encapsulating state and operations inside "objects". Object-based languages need not support inheritance or subtyping, but those that do are also said to be "object-oriented"...

 rather than a true object-oriented language.

Example

The following example illustrates the "ontology-oriented" type and declarations style of Go!:

Gender::= male | female.

person <˜ {dayOfBirth:[]=>day.
age:[]=>integer.
gender:[]=>Gender.
name:[]=>string.
home:[]=>string.
lives:[string]{}}.

person:[string,day,Gender,string]$=person.

person(Nm,Born,Sx,Hm)..{
dayOfBirth=>Born.
age => yearsBetween(now,Born).
gender=>Sx.
name=>Nm.
home=>Hm.
lives(Pl) :- Pl=home.
yearsBetween:[integer,day]=>integer.
yearsBetween(...) => ..
}.

newPerson:[string,day,Gender,string]=>person.

newPerson(Nm,Born,Sx,Hm)=>$person(Nm,Born,Sx,Hm).


The ::= rule defines a new algebraic data type
Algebraic data type
In computer programming, particularly functional programming and type theory, an algebraic data type is a datatype each of whose values is data from other datatypes wrapped in one of the constructors of the datatype. Any wrapped datum is an argument to the constructor...

, a data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

with only data constructors.

The rule defines an interface type - it indicates what properties are characteristic of a person and also gives type constraints on these properties. It documents that age is a functional property with an integer value, that lives is a unary relation over strings, and that dayOfBirth is a functional property with a value that is an object of type day.

The $= type rule indicates that there is also a theory label, with the functor person, for a theory that defines the characteristic properties of the person type - implements the person interface - in terms of four given parameters of types string, day, Gender, and string.

External links

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