Besides being more correct, it protects against people accidentally
exchanging the permission and open mode arguments to Open.
R=rsc
CC=golang-dev
https://golang.org/cl/1904045
Background: The current spec is imprecise with respect to the parsing ambiguity
for composite literals: It says that the ambiguity arises when the TypeName form
of the LiteralType is used. The following code:
if (B) {} ...
is not using the TypeName form (but the parenthesized TypeName form) and thus
could be interpreted as:
if ((B){}) ...
instead of
if B {} ...
Both compilers and gofmt choose the latter interpretation. One could fix the
spec by making the clause regarding the parsing ambiguity more precise ("...using
the _possibly parenthesized_ TypeName form of the LiteralType..."). The alternative
(chosen here) is to simply disallow parenthesized literal types. Except for a single
test case (test/parentype.go) there appears to be no Go code under $GOROOT containing
parenthesized literal types. Furthermore, parentheses are never needed around a
literal type for correct parsing.
R=golang-dev
CC=golang-dev
https://golang.org/cl/1913041
This is a stop-gap change to give more current information visibility
before a more thorough reorganization.
R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/1902042
We didn't mention this explicitly during our discussions,
but I think it fits the "identical types are spelled identically"
rule that we used.
R=gri, iant, ken2, r, rsc1
CC=golang-dev
https://golang.org/cl/1698043
Specifically:
- introduced notion of "underlying type"
- removed notion of type compatibility
- consolidated rules about assignment compatibility in
assignment compatibility section
- be consistent with specyfing that nil is the value
for uninitialized variables that can be nil (this
was not specified clearly for pointers, functions, interfaces)
- added/fixed various related links throughout
- clarify language on conversions
R=rsc, r, iant, ken2
CC=golang-dev
https://golang.org/cl/1536041
Specifically:
- Simplified definition of comparison compatibility and folded into
section on comparison operators since it's only used there.
This is a small language change/cleanup. As a consequence:
- An interface value may now be compared against a non-interface value.
- Channels with opposite directions cannot be compared directly anymore
(per discussion with rsc).
R=rsc, r, iant, ken2
CC=golang-dev
https://golang.org/cl/1462041
and adjust conversion rules.
Also:
- clarification of type identity (no language change)
- adjust special rules for channel assignment/comparison to
require identical element types (in correspondence to non-
recursiveness of type compatibility)
R=rsc, iant, ken2, r
CC=golang-dev
https://golang.org/cl/1376042