Content deleted Content added
m fixed reference |
remove random crap |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1:
{{Short description|Multi-paradigm programming language}}
{{for|the language released in 2009 by Google|Go (programming language)}}
{{Infobox programming language
Line 12 ⟶ 13:
| latest_release_date =
| latest_test_version = 9-30-07
| latest_test_date = {{Start date and age
| typing = [[strong typing|strong]]
| implementations =
Line 26 ⟶ 27:
== Design ==
The authors of Go! describe it as "a [[multi-paradigm programming language]] that is oriented to the needs of programming secure, production quality and agent-based applications. It is [[multi-threaded]], strongly typed and [[higher order function|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 needed. Threads in different agents communicate and coordinate using asynchronous messages. Threads within the same agent can also use shared dynamic relations acting as [[Linda (coordination language)|Linda]]-style [[tuple space|tuple stores]]."<ref name="aamas">{{cite book |last1=Clark |first1=K.L. |last2=McCabe |first2=F.G. |
The authors also propose that the language is suitable for representing [[Ontology (information science)|ontologies]] due to its integration of [[logic programming|logic]], [[functional programming|functional]] and [[imperative programming|imperative]] styles of programming.<ref name="applied">{{cite journal | doi=10.1007/s10489-006-8511-x | title=Ontology oriented programming in go! | date=2006 | last1=Clark | first1=K. L. | last2=McCabe | first2=F. G. |
== Example ==
The following example illustrates the "ontology-oriented" type and declarations style of Go!:<ref name=applied />
<syntaxhighlight lang="prolog">
person [[#interface|'''<~''']] {dayOfBirth:[] '''=>''' ''day''.▼
age:[] '''=>''' ''integer''.▼
sex:[] '''=>''' Sex.▼
name:[] '''=>''' ''string''.▼
home:[] '''=>''' ''string''.▼
lives:[''string'']{}}.▼
person:[''string'', ''day'', Sex, ''string''] [[#theory|'''$=''']] person.▼
person(Nm, Born, Sx, Hm)..{▼
dayOfBirth() '''=>''' Born.▼
age() '''=>''' yearsBetween(now(), Born).▼
sex() '''=>''' Sx.▼
name() '''=>''' Nm.▼
home() '''=>''' Hm.▼
lives(Pl) [[Prolog#Rules and facts|''':-''']] Pl '''=''' home().▼
yearsBetween:[''integer'', ''day''] '''=>''' integer.▼
yearsBetween(...) '''=>''' ..▼
}.▼
newPerson:[''string'', ''day'', Sex, ''string''] '''=>''' person.▼
newPerson(Nm, Born, Sx, Hm) '''=>''' $person(Nm, Born, Sx, Hm).▼
{{anchor|algebraic}}The <code>::=</code> rule defines a new [[algebraic data type]], a [[data type]] with only data constructors.▼
{{anchor|interface}}The <code><~</code> rule defines an interface type - it indicates what properties are characteristic of a <code>person</code> and also gives type constraints on these properties. It documents that <code>age</code> is a functional property with an integer value, that <code>lives</code> is a unary relation over strings, and that <code>dayOfBirth</code> is a functional property with a value that is an object of type <code>day</code>.▼
{{anchor|theory}}The <code>$=</code> type rule indicates that there is also a theory label, with the functor <code>person</code>, for a theory that defines the characteristic properties of the <code>person</code> type - implements the <code>person</code> interface - in terms of four given parameters of types <code>string</code>, <code>day</code> , <code>Sex</code>, and <code>string</code>.▼
</syntaxhighlight>
▲
▲
▲
==Conflict with Google==
Line 86 ⟶ 85:
[[Category:Concurrent programming languages]]
[[Category:Free
[[Category:Programming languages created in 2003]]
|