TypeSpecList = TypeSpec { ";" TypeSpec }.
- type List // foward declaration
+ type List // forward declaration
type IntArray [16] int
type (
Point struct { x, y float };
this construct can be used to
declare local temporary variables.
+TODO: var a, b = 1, "x"; is permitted by grammar but not by current compiler
Function and method declarations
----
convert(map[string]int, "1", 1, "2", 2)
convert(struct{ x int; y float }, 3, sqrt(2.0))
+TODO: are interface/struct and 'any' conversions legal? they're not
+equivalent, just compatible. convert([]any, 1, "hi", nil);
+
There is syntactic help to make conversion expressions simpler to write.
If the result type is of ConversionType (a type name, array type,
A program is package clause, optionally followed by import declarations,
followed by a series of declarations.
- Program = PackageClause { ImportDecl } { Declaration } .
+ Program = PackageClause { ImportDecl [ ";" ] } { Declaration [ ";" ] } .
TODO
- TODO: type switch?
- TODO: words about slices
- TODO: I (gri) would like to say that sizeof(int) == sizeof(pointer), always.
+- TODO: really lock down semicolons