Robert Griesemer, Rob Pike, Ken Thompson
----
-(September 30, 2008)
+(October 1 2008)
This document is a semi-formal specification of the Go systems
<!--
Open issues according to gri:
+[ ] anonymous types are written using a type name, which can be a qualified identifier.
+ this might be a problem when referring to such a field using the type name.
[ ] clarification on interface types, rules
[ ] convert should not be used for composite literals anymore,
in fact, convert() should go away
[ ] 6g allows: interface { f F } where F is a function type. fine, but then we should
also allow: func f F {}, where F is a function type.
[ ] provide composite literal notation to address array indices: []int{ 0: x1, 1: x2, ... }
+ and struct field names (both seem easy to do).
Decisions in need of integration into the doc:
[ ] pair assignment is required to get map, and receive ok.
+ & += &= && == != ( )
- | -= |= || < <= [ ]
* ^ *= ^= <- > >= { }
- / << /= <<= ++ = := . :
- % >> %= >>= -- ! ... , ;
+ / << /= <<= ++ = := , ;
+ % >> %= >>= -- ! ... . :
Reserved words
break default func interface select
case else go map struct
- const export goto package switch
- chan fallthrough if range type
+ chan export goto package switch
+ const fallthrough if range type
continue for import return var
StructType = "struct" "{" [ FieldList [ ";" ] ] "}" .
FieldList = FieldDecl { ";" FieldDecl } .
- FieldDecl = [ IdentifierList ] Type .
+ FieldDecl = IdentifierList Type | TypeName .
// An empty struct.
struct {}
A struct may contain ``anonymous fields'', which are declared with
a type name but no explicit field name. Instead, the type name acts as the
-field name.
+field name. Anonymous fields must not be interface types.
// A struct with a single anonymous field of type T.
struct {