Go! (programming language): Difference between revisions

Content deleted Content added
Example: manual syntax highlighting of operators and primitive datatypes
Example: {{anchor}}s and internal links
Line 35:
The following example illustrates the "ontology-oriented" type and declarations style of Go!:<ref name=applied />
 
Gender [[#algebraic|'''::=''']] male | female.
person [[#interface|'''<˜''']] {dayOfBirth:[] '''=>''' ''day''.
age:[] '''=>''' ''integer''.
gender:[] '''=>''' Gender.
Line 44:
lives:[''string'']{}}.
person:[''string'', ''day'', Gender, ''string''] [[#theory|'''$=''']] person.
person(Nm, Born, Sx, Hm)..{
Line 61:
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 string, <code>day</code>, <code>Gender</code>, and <code>string</code>.
 
==Conflict with Google==