1
0
mirror of https://github.com/golang/go synced 2024-09-24 05:10:13 -06:00
Commit Graph

395 Commits

Author SHA1 Message Date
Robert Griesemer
3906706297 spec: index and array/slice size constants must fit into an int
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6903048
2012-12-12 11:06:26 -08:00
Robin Eklind
1d46fc44b7 spec: Correct typo in method expressions example.
Also, remove unnecessary whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6928045
2012-12-11 12:17:53 -05:00
Robert Griesemer
9c9e811bb3 spec: consistently use "indices" (rather than "indexes")
We have been using all three terms "indices", "indexes",
and "index expressions" indiscriminatly for index values.
With this change, "index" refers to an index value,
"indices" is the plural of "index", and "index expression"
refers to an array, slice, or map indexed by an index: a[x].

R=r, rsc, iant, ken, mtj
CC=golang-dev
https://golang.org/cl/6912056
2012-12-10 11:55:57 -08:00
Robert Griesemer
e06d90136f spec: receiver types in method expressions can be parenthesized
Fixes #4457.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6862046
2012-12-06 09:31:42 -08:00
Robert Griesemer
485673188d spec: type assertions and type switches must be valid
The spec didn't preclude invalid type assertions and
type switches, i.e., cases where a concrete type doesn't
implement the interface type in the assertion in the first
place. Both, the gc and gccgo compiler exclude these cases.
This is documenting the status quo.

Also:
- minor clean up of respective examples
- added sentence about default case in select statements

Fixes #4472.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6869050
2012-12-06 09:17:20 -08:00
Robert Griesemer
458632a21a spec: BuiltinCall syntax must permit "..." for append
Also: fix an incorrect link.

Fixes #4479.
Fixes #4456.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6868062
2012-12-04 13:09:02 -08:00
Robert Griesemer
cc3f21cefe spec: channel operations are restricted by the channel direction
Also:
- 'for' statements with a range clause do not accept send-only
   channels
- '_, _ = range ch' is not equivalent to "_ = range ch" if ch
   is a channel (rewriting the latter to the former leads to
   an invalid range clause).

These clarifications document the status quo.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/6874053
2012-12-03 14:23:41 -08:00
Robert Griesemer
85e451e2fe go spec: receiver, parameter, and result names must always be unique
Fixes #4450.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6845104
2012-11-29 14:47:47 -08:00
Robert Griesemer
25dd00295c spec: clarify use of built-ins in go/defer statements
1) Built-ins are restricted like for expression statements.
   This documents the status quo.

2) Calls cannot be parenthesized. The spec is not clear. gccgo
   permits it already, gc doesn't. Be explicit in the spec.

 Fixes #4462.

R=rsc, iant, r, ken, lvd
CC=golang-dev
https://golang.org/cl/6861043
2012-11-29 11:46:25 -08:00
Russ Cox
d4f3185c24 spec: add () to method calls in examples
Since p.M is rejected (must call methods), use p.M(),
to keep the examples compiling.

Fixes #4441.

R=gri
CC=golang-dev
https://golang.org/cl/6854096
2012-11-26 15:43:32 -05:00
Robert Griesemer
e126763045 spec: be clearer about the scope of a package name
We have the notion of a PackageName, not package identifier.
As is, it could construed that imports that rename a package
don't have an "imported package identifier" but a local one.

R=r, rsc, iant, ken, dsymonds
CC=golang-dev
https://golang.org/cl/6858049
2012-11-21 14:40:50 -08:00
Robert Griesemer
2ae61d557a spec: fix constant expression example
Fixes #4400.

R=r, mirtchovski
CC=golang-dev
https://golang.org/cl/6782084
2012-11-17 11:16:07 -08:00
Oling Cat
002103f51c spec: we're now at Unicode 6.2.0
R=golang-dev
CC=golang-dev
https://golang.org/cl/6818083
2012-11-01 22:57:01 -07:00
Robert Griesemer
1e8e14c901 spec: clarify returns, defer statements, and panics
This is an attempt at making the interaction between
these three constructs clearer. Specifically:

- return statements terminate a function, execute deferred
  functions, return to the caller, and then execution
  continues after the call

- panic calls terminate a function, execute deferred
  functions, return to the caller, and then re-panic

- deferred functions are executed before a function _returns_
  to its caller

The hope is that with this change it becomes clear when a
deferred function is executed (when a function returns),
and when it is not (when a program exits).

R=r, rsc, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6736071
2012-11-01 10:13:48 -07:00
Robert Griesemer
369a974b41 spec: slight wording change to remove a formal contradiction
Fixes #4324.

R=r
CC=golang-dev
https://golang.org/cl/6822062
2012-10-31 15:07:25 -07:00
Rob Pike
7ea65e5154 spec: we're now at Unicode 6.2.0
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6812060
2012-10-31 10:32:15 -07:00
Robert Griesemer
ddddd39fc8 go spec: constant divisors must not be zero
Both gc and gccgo always checked this for constant
expressions but the spec only mentions run-time
exceptions.

This CL also requires that constant divisors
must not be zero in non-constant integer expressions:
This is consistent with the spirit of the most
recent changes and it is consistent with constant
expressions. We don't want to specify the effect for
non-integer expressions (f/0.0 where f is a float or
complex number) because there the result f/g is not
further specified if a non-constant g is 0.

R=r, rsc, iant, ken, andybalholm, iant
CC=golang-dev
https://golang.org/cl/6710045
2012-10-19 10:12:09 -07:00
Robert Griesemer
3bde00033b go spec: define make() restrictions as for index expressions
This is a language change: Until now, the spec required run-
time panics for some of these errors. Note that gc and gccgo
implemented this inconsistently, and that both compilers already
reported compile-time errors in some cases. This change makes
make() behave along the same vein as index expressions.

This addresses the spec aspect of issue 4085.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6725053
2012-10-19 10:11:06 -07:00
Robert Griesemer
ea7c57a031 go spec: restrictions for index and slice expressions
At the moment, gc and gccgo report compile-
time errors for certain constant indexes that
are out of bounds. The spec however requests
a run-time panic for out-of-bounds indexes
(http://tip.golang.org/ref/spec#Indexes).

Document the status quo.

Fixes #4231.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6699048
2012-10-17 11:08:42 -07:00
Rob Pike
15970c8d6d spec: more clarification about deferred functions
Proposed new text to make matters clearer. The existing text was
unclear about the state of result parameters when panicking.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6653047
2012-10-16 11:27:20 +11:00
Rob Pike
f04ae1373e spec: clarify defer semantics
It's already there but only in the "for instance" and so not
clear enough: deferred functions run after
the result parameters are updated.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6631058
2012-10-10 13:29:50 +11:00
Robert Griesemer
3188ffc931 go spec: conversion types starting with "func" must be parenthesized
Also: Be explicit what operator means with respect to conversion types.

The parenthesis requirement is a language change. At the moment,
literal function types in conversions that cannot possibly be
followed by a '(' don't need parentheses. For instance:

        func(int)int(x)  ->  same as (func(int)int)(x)
        func()()(x)      ->  same as (func())(x)

but:

        func(int)(x)	 ->  could be func(int)x {...}

Fixes #4109.

R=rsc, r, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6584065
2012-10-03 13:46:37 -07:00
Robert Griesemer
0c494718af go spec: arguments for append may overlap
Fixes #4142.

R=rsc, r, iant, ken, remyoudompheng
CC=golang-dev
https://golang.org/cl/6567062
2012-09-28 15:55:38 -07:00
Robert Griesemer
60a6ae8c3c spec: permit trailing comma in conversions
Also: Adjust prose in Conversions section
to be consistent.

This is a backward-compatible syntax change.
For a discussion see issue 2568.

Fixes #2568.
Fixes #4123.

R=golang-dev, r, iant, rsc
CC=golang-dev
https://golang.org/cl/6572049
2012-09-26 10:31:57 -07:00
Rob Pike
b51ad9cf45 spec: a couple of minor tweaks to the wording of the import section
- remove ambiguous 'it'
- use a lower-case PackageName in the example

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6552057
2012-09-23 05:03:43 +10:00
Robert Griesemer
8c058b32d1 spec: clarify expression statements
Function and method calls are valid expression statements,
but calling certain built-in functions is not permitted.
Enumerate the built-ins.

Also: unsafe.Offsetof permits parenthesized selectors as
arguments.

This is simply documenting existing compiler behavior
(both gc and gccgo agree).

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6498138
2012-09-18 11:25:53 -07:00
Robert Griesemer
c7631f555f spec: unsafe.Alignof/Sizeof also accept non-variable arguments
Both gc and gccgo permit calls such as unsafe.Sizeof(42). The
spec only permits variable arguments. This is a (backward-compatible)
spec change reflecting the status quo. Seems preferrable over
restricting the compilers.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6494140
2012-09-17 12:23:41 -07:00
Robert Griesemer
cc06593c68 spec: clarify section on string types
Strings happen to be represented similarly to
byte slices internally, but they don't quite
behave like them: While strings can be indexed,
sliced, and have their len() taken like byte
slices, string elements are not addressable,
make() and cap() is not supported, range loops
operate differently, and they are immutable (and
thus behave like values rather then references).

Fixes #4018.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6503116
2012-09-14 11:31:56 -07:00
Russ Cox
1b4e37a43c spec: make bitwise operators stand out
The (and not) arguably sounds like it is trying to say something - and not what?.

Just an idea, won't be hurt if it gets rejected.

R=gri, dsymonds, r
CC=golang-dev
https://golang.org/cl/6498115
2012-09-12 12:05:24 -04:00
Rob Pike
488350ac42 spec: an initial BOM can be ignored
After further deliberation, let's back down to the Unicode proposal.
Ignoring aBOMinations anywhere means that things like
        grep unsafe *.go
might fail because there's a BOM in the middle: unBOMsafe.

R=golang-dev, rsc, 0xjnml, gri, bradfitz
CC=golang-dev
https://golang.org/cl/6490091
2012-09-07 10:28:24 -07:00
Rob Pike
afac01df48 spec: ignore BOMS outside of string and rune literals.
Happy Birthday UTF-8.

R=golang-dev, rsc, 0xjnml
CC=golang-dev
https://golang.org/cl/6506083
2012-09-06 10:37:13 -07:00
Oling Cat
845f4d6b47 doc/go_spec: fix a typo
R=nigeltao
CC=golang-dev
https://golang.org/cl/6499075
2012-09-05 14:53:13 +10:00
Rob Pike
9dfc6f6427 go_spec.html: clarify rune and string literals
No changes to the meaning, just clearer language and more
examples, including illegal rune and string literals.
In particular, "character literal" and "character constant"
are now called "rune literal" and "rune constant" and the
word "character" always refers to the source text, not
program values.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6448137
2012-08-29 14:46:57 -07:00
Robert Griesemer
95a00cae2e go_spec: unary + and - are also defined for complex types
R=r, rsc, iant, ken, iant
CC=golang-dev
https://golang.org/cl/6450150
2012-08-17 11:36:21 -07:00
Robert Griesemer
f05a91e18b spec: clarify evaluation order
Fixes #3852.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6441102
2012-08-09 11:50:16 -07:00
Rémy Oudompheng
2b4cc6ccb5 spec: correct typo in string conversion examples.
R=golang-dev, dave, r
CC=golang-dev, remy
https://golang.org/cl/6378046
2012-07-11 20:26:51 +02:00
Matthew William Jibson
f83a47cbb9 doc: various "the the" and other typos
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6355076
2012-07-08 11:57:04 +10:00
Robert Griesemer
71de83b733 go spec: clean up section on selectors
- point out difference between selectors and qualified identifiers
- differentiate between illegal selectors and run-time panics
- use "indirect" as opposed to "dereference" consistently
- add extra links

Fixes #3779.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6326059
2012-06-28 12:22:24 -07:00
Robert Griesemer
809e06babc go spec: clean up use of QualifiedIdent production.
Fixes #3763.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/6333066
2012-06-26 11:49:19 -07:00
Robert Griesemer
689931c5b0 spec: clarify receive operator
- receiving from a closed channel returns immediately
- in the ,ok form, the 2nd result is of type bool, not
  just boolean (gc and ggcgo agree).

Per dsymonds' suggestion.

R=r, rsc, ken, iant, dsymonds
CC=golang-dev
https://golang.org/cl/6333057
2012-06-25 11:28:24 -07:00
Robert Griesemer
787adb6eb3 go spec: clarify promotion rules for methods/fields of anonymous fields
Fixes #3635.

R=rsc, r, iant, kevlar, iant
CC=golang-dev
https://golang.org/cl/6217045
2012-06-04 14:24:10 -07:00
Robert Griesemer
2dde4f5d29 spec: clarify evaluation order of "i, x[i] = range ..."
Part of fix for issue 3464.

R=golang-dev, rsc, mirtchovski, iant, r
CC=golang-dev
https://golang.org/cl/6246045
2012-05-24 10:59:48 -07:00
Shenghou Ma
9bc8dd3985 doc/go_spec: fix a typo
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5989065
2012-04-10 01:50:46 +08:00
Hong Ruiqi
8374e67876 doc/go_spec: fix typo
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5990043
2012-04-05 22:37:07 +10:00
Shenghou Ma
2195f1aa04 doc/go_spec: fix broken link
Part of issue 3424

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5955049
2012-03-30 14:04:03 +08:00
Jeremy Jackins
7e054266c9 doc: various typos, remove apostrophes from ordinals
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5845059
2012-03-19 08:26:36 +11:00
Rob Pike
883a96d950 spec: delete references to unsafe.Reflect,Typeof,Unreflect
They have been deleted from package unsafe.
Also delete their appearance in exp/types.

Fixes #3338.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5847056
2012-03-17 22:50:59 +11:00
Robert Griesemer
82fc28c0f5 go spec: fix inaccuracy in type identity definition
Pointed out by Steven Blenkinsop (steven099@gmail.com)
via golang-nuts.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5783087
2012-03-12 20:27:27 -07:00
Robert Griesemer
11d8b155ce go_spec: no known implementation differences anymore
R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/5781048
2012-03-07 22:17:40 -08:00
Andrew Gerrand
a22b0f82a2 doc: add command docs page, canonicalize reference paths
R=golang-dev, kyle, r
CC=golang-dev
https://golang.org/cl/5728055
2012-03-05 15:30:27 +11:00