1
0
mirror of https://github.com/golang/go synced 2024-11-21 17:54:39 -07:00
The Go programming language
Go to file
Robert Griesemer 07cc6440dc go_spec: don't allow parens around the literal type of composite literals
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
2010-07-29 18:13:41 -07:00
doc go_spec: don't allow parens around the literal type of composite literals 2010-07-29 18:13:41 -07:00
include gc: fix SIGBUS 2010-07-28 18:21:50 -07:00
lib doc: update front page and go_learning.html 2010-07-30 10:36:13 +10:00
misc dashboard: more aggressive caching for project/package pages 2010-07-27 15:02:44 +10:00
pkg more description 2009-10-15 23:08:46 -07:00
src mime: add AddExtensionType 2010-07-29 14:12:04 -07:00
test go_spec: don't allow parens around the literal type of composite literals 2010-07-29 18:13:41 -07:00
.hgignore hgignore: adds bin/ to support setting $GOBIN to $GOROOT/bin 2010-07-19 14:10:00 +10:00
.hgtags release.2010-07-14 release 2010-07-15 13:07:35 +10:00
AUTHORS A+C: Yuusei Kuwana (individual CLA) 2010-07-29 13:49:01 -07:00
CONTRIBUTORS A+C: Yuusei Kuwana (individual CLA) 2010-07-29 13:49:01 -07:00
favicon.ico add a favicon plus a couple of hi-res versions of gordon 2009-10-26 10:13:07 -07:00
LICENSE Add an explicit patent grant to the Go license. 2010-01-25 15:39:32 -08:00
README add a README file, so that if someone finds a 2009-11-08 09:57:37 -08:00

This is the source code repository for the Go programming language.  

For documentation about how to install and use Go,
visit http://golang.org/ or load doc/install.html in your web browser.

After installing Go, you can view a nicely formatted
doc/install.html by running godoc --http=:6060
and then visiting http://localhost:6060/doc/install.html.

Unless otherwise noted, the Go source files are distributed
under the BSD-style license found in the LICENSE file.