Go! (programming language): Difference between revisions

Content deleted Content added
m Example: clean up using AWB (9513)
Line 37:
 
<div style="text-transform: uppercase;">
<code>
 
Gender'''::=''' male | female.
Line 63 ⟶ 64:
newPerson(Nm,Born,Sx,Hm)=>$person(Nm,Born,Sx,Hm).
 
</code>
</div>
 
The <code>::=</code> rule defines a new [[algebraic data type]], a [[data type]] with only data constructors.
 
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>.