Commit Graph

265 Commits

Author SHA1 Message Date
Robert Griesemer
bb7eb4002e go spec: clarify semantics of integer division
Fixes #1764.

R=rsc, r, iant, ken2
CC=golang-dev
https://golang.org/cl/4431082
2011-05-02 17:23:18 -07:00
Robert Griesemer
6af887ec03 go spec: restricted expressions may still be parenthesized
No language change.

- added a few examples with parentheses
- added a corresponding sentence to assignments
  (this explicitly permits: (_) = 0, currently allowed by 6g,
  gofmt, but marked as an error by gccgo).

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4446071
2011-05-02 09:16:31 -07:00
Robert Griesemer
c134718611 undo CL 4428057 / 19e540fc7d7d
The CL introduces inconsistencies with respect to
the use of parentheses/grouping of receive operations.

««« original CL description
spec: narrow syntax for expression and select statements

This is not a language change, it simply expresses the
accepted cases explicitly in the respective productions.

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4428057
»»»

R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4444080
2011-04-29 12:20:31 -07:00
Robert Griesemer
95f544a199 spec: narrow syntax for expression and select statements
This is not a language change, it simply expresses the
accepted cases explicitly in the respective productions.

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4428057
2011-04-29 09:49:10 -07:00
Robert Griesemer
1bdb1803b9 go spec: for map types, mention indexing operations
(like we do for arrays and slices).

Suggested by mathieu.lonjaret@gmail.com .

R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/4442074
2011-04-22 16:26:51 -07:00
Robert Griesemer
0f7acf1114 go spec: attempt at clarifying language for "append"
Specifically, fix a wrong comment.

Fixes #1717.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4445050
2011-04-19 14:38:49 -07:00
Rob Pike
e6b1d424c4 spec: add parens missing from "protect" example.
Fixes #1665.

R=gri
CC=golang-dev
https://golang.org/cl/4351051
2011-04-05 11:01:25 -07:00
Ian Lance Taylor
d38d66e646 doc: gccgo now supports method expressions and multiple init functions.
R=gri
CC=golang-dev
https://golang.org/cl/4314047
2011-03-28 14:48:35 -07:00
Russ Cox
108564dabc spec: disallow unused labels
Also change labelled examples to use gofmt formatting.

R=gri, r, jnml
CC=golang-dev
https://golang.org/cl/4287046
2011-03-15 13:51:24 -04:00
Russ Cox
9f2cb86fe2 spec: remove closed from language, replaced by x, ok = <-c
R=gri, r, r2
CC=golang-dev
https://golang.org/cl/4249065
2011-03-11 14:47:02 -05:00
Robert Griesemer
fb64e0d96f go spec: clarify return statement rules
Added example of a return statement w/o expressions
in a function with a _ result parameter.

See also: http://code.google.com/p/go/issues/detail?id=1586

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4266049
2011-03-07 16:29:07 -08:00
Robert Griesemer
967a2b38cd go spec: minor clarification of scope rule for functions
R=rsc, iant, r, r2
CC=golang-dev
https://golang.org/cl/4256050
2011-03-03 15:24:28 -08:00
Rob Pike
966bf71366 docs: make "runtime" a word only as a name for the package.
Computer people have an agglutinating streak that I like to resist.
As a time of execution: run time.
As an adjective: run-time.
As a noun: run-time support/code/library.

Signed,
Mr. Pedant.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4252048
2011-03-01 13:54:22 -08:00
Robert Griesemer
a1368a6ad0 go spec: make condition mandatory in if statements
Plus a few minor HTML fixes.

Fixes #1535.

R=r, rsc, ken2, iant, r2
CC=golang-dev
https://golang.org/cl/4185065
2011-02-22 15:31:57 -08:00
Robert Griesemer
556506e869 go spec: fix local link
Fixes #1543.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4169068
2011-02-22 09:34:13 -08:00
Rob Pike
e041b9980c spec: delete incorrect obsolete mention of selector working on
pointer to interface type.

R=golang-dev, niemeyer, gri
CC=golang-dev
https://golang.org/cl/4173067
2011-02-19 15:04:56 -08:00
Robert Griesemer
f14c29a311 go spec: minor clarification on channel types
No language change.

R=r, rsc, iant, ken2, r2
CC=golang-dev
https://golang.org/cl/4168050
2011-02-15 11:33:12 -08:00
Anthony Martin
0122a667b6 go spec: fix a few typos
The spec can now be parsed with an
xml.Parser using the HTML settings.

R=gri
CC=golang-dev
https://golang.org/cl/4155042
2011-02-08 14:51:15 -08:00
Robert Griesemer
2a838d6424 go spec: clarification re: method sets of newly declared pointer types
- added an example to Type declarations section clarifying the
  situation brought up with issue 1324
- slightly re-ordered paragraphs in Types section
- added separate heading for method set section and refer to it
  from elsewhere in the spec
- no language changes

R=rsc, r, iant, ken2, r2
CC=golang-dev
https://golang.org/cl/4145043
2011-02-08 13:31:01 -08:00
Gustavo Niemeyer
f8404ee3e1 spec: fix Typeof() return type
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4121058
2011-02-04 09:29:08 -08:00
Robert Griesemer
76f3228520 go spec, effective go: cleanups
Removed most of the detailed examples about handing panics
from the go spec since it's now covered by Effective Go.

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/4128058
2011-02-04 08:43:21 -08:00
Robert Griesemer
838b5ad9d6 go spec: move to Unicode 6.0
R=r, r2
CC=golang-dev
https://golang.org/cl/4128055
2011-02-03 12:27:41 -08:00
Robert Griesemer
fa3d0d73f0 go spec: adjust notion of Assignability
This change makes it legal to pass a struct value as receiver
outside the package declaring the struct even if the respective
struct type has non-exported fields.

This is a backwards-compatible language change motivated by the
fact that it is already possible to circumvent the assignment
restriction when calling methods through interfaces (see issue
1402).

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/3926044
2011-02-03 10:53:31 -08:00
Russ Cox
a6736cae30 spec: allow imported packages named main
Prior to this CL, there were two requirements about the
package name main.

1. The package that sits at the root of the import graph
   (the one where program execution begins)
   must be named main.

2. No other package in the program can be named main.

This CL only removes requirement #2, which can be done
without changing any other Go documentation.

The new wording and formatting is such that removing
requirement #1 can be done by deleting a single line,
but making that change is explicitly outside the scope
of this CL, because it would require changes to other
documentation at the same time.

R=gri, r, gri1
CC=golang-dev
https://golang.org/cl/4126053
2011-02-03 13:40:51 -05:00
Robert Griesemer
7fc4e37853 go spec: s/log.Crash/log.Panic/
There is no log.Crash.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4058048
2011-02-01 12:51:10 -08:00
Robert Griesemer
b50ed022f5 go spec: follow-up cleanups after communication operator changes
These are syntactical changes to better reflect the communication
operator's new status in the language.

- sending to a channel is now done via a send statement
- there is no binary communication operation anymore which
  leads to a reduction of the number of precedence levels
  from 6 to 5 (yeah!)
- small semantic change: since a send operation is not part
  of the expression syntax anymore, a <- send operator is
  binding weaker than any other operator now
- receiving from a channel is done as before via the unary
  receive expression
- communication clauses in select statement now can contain
  send statements or receive expressions

R=rsc, r, iant, ken2, gri1
CC=golang-dev
https://golang.org/cl/3973051
2011-02-01 12:02:49 -08:00
Russ Cox
614391860a ebnflint: exit with non-zero status on error
Tweak spec to avoid ebnflint complaints.

R=gri
CC=golang-dev
https://golang.org/cl/3973050
2011-01-31 17:42:10 -05:00
Russ Cox
19d9a40845 spec: remove non-blocking channel operators
Add intended changes for close + closed, commented out.

R=golang-dev, niemeyer, r, gri1
CC=golang-dev
https://golang.org/cl/4013045
2011-01-27 15:34:28 -05:00
Robert Griesemer
0e1d941e5c go spec: clarify address operators.
Fixes #1445.

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/4109041
2011-01-26 11:21:23 -08:00
Russ Cox
27c74d3499 spec, runtime, tests: send on closed channel panics
Close of closed channel panics.
Receive from closed channel never panics,
even if done repeatedly.

Fixes #1349.
Fixes #1419.

R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry
CC=golang-dev
https://golang.org/cl/3989042
2011-01-21 15:07:13 -05:00
Robert Griesemer
b94c0d2a77 go spec: remove float, complex in favor of float64 and complex128
The default float type is not very useful but for the most basic applications.
For instance, as it is now, using the math package requires conversions for float
variables (the arguments for math functions are usually float64). Typical real
applications tend to specify the floating point precision required.

This proposal removes the predeclared types float and complex. Variable declarations
without type specification but with constant floating point or complex initializer
expressions will assume the type float64 or complex128 respectively.

The predeclared function cmplx is renamed to complex.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/3423041
2011-01-19 23:07:21 -05:00
Robert Griesemer
dfc5bb5ff6 go spec: adjust language for constant typing
Fixes #1421.

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/4039042
2011-01-19 10:33:41 -08:00
Robert Griesemer
97025ebfef go_spec: specify that int and uint have the same size
R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/3992041
2011-01-13 10:24:04 -08:00
Robert Griesemer
dd916be3d8 go spec: remove Maxalign from spec
Fixes #1285.

R=r, rsc, iant, ken2, r2
CC=golang-dev
https://golang.org/cl/3918041
2011-01-10 14:25:17 -08:00
Rob Pike
29d0f02bd2 effective go: explain the effect of repanicking better.
Also fix a <p> error in go_spec.html.

Fixes #1370.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/3835043
2011-01-05 11:39:57 -08:00
Anthony Martin
11a016151b go spec: fix two grammar typos
R=gri
CC=golang-dev
https://golang.org/cl/3580042
2010-12-13 22:19:41 -08:00
Robert Griesemer
777a96a5b0 go_spec: fixed a couple omissions/type errors
- use math.Sqrt instead of Math.sqrt
- use float64 for Point fields to match math.Sqrt
- distinguish between Point and Point3D for clarity
- add alignment sizes for complex types

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/3420041
2010-12-02 12:32:14 -08:00
Anschel Schaffer-Cohen
5083eedf88 Fixed recover() documentation.
Added a "return" to the end of an example which previously threw a compile error if used.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/3052041
2010-11-12 09:57:46 -08:00
Peter Mundy
5928e1d4dc doc: fix go_spec spelling errors
R=gri
CC=golang-dev
https://golang.org/cl/2970042
2010-11-09 10:10:57 -08:00
Peter Mundy
9626180918 doc: fix go_spec spelling error
R=rsc, gri
CC=golang-dev
https://golang.org/cl/2985041
2010-11-09 08:46:13 -08:00
Robert Griesemer
d73d1c5f32 go spec: line comments may end in EOF
Consistency argument: A valid Go program should
remain valid after stripping leading and trailing
whitespace. This was not true so far if the last
text in the source was a line comment.

R=iant, ken2, r, rsc, r2
CC=golang-dev
https://golang.org/cl/2906041
2010-11-04 13:48:32 -07:00
Robert Griesemer
11684680fa go spec: append is now implemented
R=r, r2
CC=golang-dev
https://golang.org/cl/2717043
2010-10-29 11:44:48 -07:00
Robert Griesemer
904adfdc46 go spec: clarify return type of append, argument type for ...T parameters
R=iant, ken2, r, rsc
CC=golang-dev
https://golang.org/cl/2774041
2010-10-27 10:44:31 -07:00
Robert Griesemer
a8abb64a71 go spec: note re: append() not being implemented yet
R=rsc
CC=golang-dev
https://golang.org/cl/2761041
2010-10-26 20:30:35 -07:00
Robert Griesemer
07e983a965 go spec: append built-in
R=iant, ken2, r, rsc
CC=golang-dev
https://golang.org/cl/2627043
2010-10-25 16:50:31 -07:00
Robert Griesemer
425bbadd3c go_spec: allow copy() to copy bytes from a string into a []byte
(language change as discussed a while ago)

R=iant, ken2, r, rsc
CC=golang-dev
https://golang.org/cl/2716041
2010-10-25 16:41:06 -07:00
Robert Griesemer
a12141e5f4 go spec: relaxed syntax for array, slice, and map composite literals
For elements which are themselves composite literals, the type may
be omitted if it is identical to the element type of the containing
composite literal.

R=r, rsc, iant, ken2
CC=golang-dev
https://golang.org/cl/2661041
2010-10-22 08:58:52 -07:00
Russ Cox
bee2d5b0ad gc, spec, tests: no auto-indirect of pointer to interface value
Implies no embedding of pointer to interface value either.

R=gri, iant, ken2, r, r2
CC=golang-dev
https://golang.org/cl/2289041
2010-09-30 14:59:41 -04:00
Robert Griesemer
5474e166bc go spec: clarifications for range clause
R=iant, r, rsc, rog
CC=golang-dev
https://golang.org/cl/2226047
2010-09-28 14:44:19 -07:00
Russ Cox
00ffd59c1a gc: fix reflect table method receiver
Fixes #451.
Fixes #770.

R=ken2
CC=golang-dev
https://golang.org/cl/2207045
2010-09-28 13:43:50 -04:00