1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:18:33 -06:00
Commit Graph

579 Commits

Author SHA1 Message Date
Robert Griesemer
bb3a32ef6e spec: fix language about "range" clause
Fixes #5434.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9595044
2013-05-20 13:27:53 -07:00
Shenghou Ma
df29cdd33d doc/go_spec: fix typos
Fixes #5456.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9400044
2013-05-15 03:50:27 +08:00
Robert Griesemer
2d846f6521 spec: fix incorrect example
Fixes #5430.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9305043
2013-05-08 10:42:08 -07:00
Rob Pike
548c65a568 spec: add another sentence about BOMs
Although one may argue that they should be legal, gc (at least)
disallows byte order marks that are not the first code point
in the file. Added a sentence to the "Implementation restriction"
clause in the "Source code representation" section to document
this better.

Lifting this restriction (again - the rule has changed at least
twice already) would not break any existing programs, should
we later decide yet again to fiddle the rules about these little
fly specks.

R=golang-dev, dsymonds, gri
CC=golang-dev
https://golang.org/cl/8649043
2013-04-11 11:33:25 -07:00
Robert Griesemer
b34f055138 spec: Go has no 'reference types'
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8288044
2013-04-02 23:17:37 -07:00
Robert Griesemer
462a17e0f3 spec: remove most §links for the now more common in-text links
Also:
- more consistenly use "xxx" statement rather than <code>xxx</code> statement
- fix/remove unnecessary links

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7821050
2013-03-22 15:36:04 -07:00
Rob Pike
d02089101c spec: add example showing missing return statement
Will help people find the rules by searching the spec by
having a comment saying "missing return";
"terminating statement" does not evoke the rule to the
uninitiated.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7838044
2013-03-22 10:03:55 -07:00
Rob Pike
b636f192e2 spec: fix description of initialization
The analysis does not depend on the values of the items.
Fixes #4648.

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/7593050
2013-03-20 15:05:28 -07:00
Russ Cox
6e15683cae spec: define method values
Fixes #2280.

R=golang-dev, r, bradfitz, iant, andybalholm, gri
CC=golang-dev
https://golang.org/cl/7816045
2013-03-20 16:54:07 -04:00
Robert Griesemer
58e21ddaf9 spec: remove special int rule for shifts
The rule is not concistently followed by gc.
It appears that gccgo is ignoring it. go/types
does not implement this rule. However, both
gccgo and now go/types can compile/type-check
the entire std library (and thus all the shift
expressions occuring in it) w/o errors. For
more details see the discussion in issue 4883.

Fixes #4880.
Fixes #4881.
Fixes #4883.

R=rsc, r, iant, ken, ken, mtj, rogpeppe
CC=golang-dev
https://golang.org/cl/7707043
2013-03-15 13:55:50 -07:00
Rob Pike
c34050fd53 spec: rewrite the description of panic and recover.
The old description was misleading and inaccurate.

Fixes #4774.

R=iant, rsc, gri
CC=golang-dev
https://golang.org/cl/7761044
2013-03-12 14:28:16 -07:00
Robert Griesemer
b66df0e9ba spec: typed indices must be of integer type
The same rules apply for make arguments.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/7656043
2013-03-11 09:20:52 -07:00
Robert Griesemer
c729ed631f spec: result type of a comparison is always untyped bool
For details see the cited issue.

Fixes #4793.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/7524044
2013-03-11 09:16:29 -07:00
Robert Griesemer
51338095eb spec: clarify unsafe.Offsetof
Fixes #4905.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/7583043
2013-03-07 20:11:37 -08:00
Robert Griesemer
9905cec0dc spec: terminating statements for functions
The only functional change is the new section
on terminating statements.

There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).

Includes some minor fixes/additions of missing links.

Based closely on Russ' proposal.

Fixes #65.

R=rsc, r, iant, ken, bradfitz
CC=golang-dev
https://golang.org/cl/7415050
2013-03-04 13:55:35 -08:00
Robert Griesemer
4be38dde84 spec: cyclic imports are illegal
Fixes #4976.

R=r
CC=golang-dev
https://golang.org/cl/7421050
2013-03-04 12:59:40 -08:00
Robert Griesemer
67a6b4f0ef spec: fallthrough may not appear in last clause of a switch
Replacement for CL 7370053 which attempted to make fallthrough's
syntactically a part of switch statements. Because they may be
labeled, fixing that CL completely would require too much spec
surgery.

Fixes #4923.

R=r, iant, rsc, ken
CC=golang-dev
https://golang.org/cl/7416048
2013-03-01 16:45:14 -08:00
Rob Pike
7ae41e8010 doc: correct some minor HTML errors found by tidy
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7439046
2013-02-28 13:32:36 -08:00
Russ Cox
61e02ee901 spec: clarify when range x does not evaluate x
Fixes #4644.

R=r, adonovan
CC=golang-dev
https://golang.org/cl/7307083
2013-02-15 14:39:28 -05:00
Russ Cox
71c941b6f6 spec: only require parens around ambiguous conversions
This is documenting the status quo. The previous cleanup
added this language as an implementation restriction, but
at least for now it is really part of the language proper.

Fixes #4605.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7305071
2013-02-11 07:48:14 -05:00
Russ Cox
7576179aa3 spec: document fp rounding during explicit constant conversion
The gc compilers already behave this way. It was an explicit
decision during the very long constant design discussions,
but it appears not to have made it into the spec.

Fixes #4398.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7313069
2013-02-11 07:47:41 -05:00
Russ Cox
0a22018d46 spec: reject top-level init names
Fixes #4586.

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/7307082
2013-02-11 07:46:39 -05:00
Russ Cox
81eb930f7e spec: clarify that any unsafe.Pointer type is okay in conversion
The spec is not clear about whether this is allowed or not,
but both compilers allow it, because the reflect implementation
takes advantage of it. Document current behavior.

Fixes #4679.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7303064
2013-02-09 17:36:31 -05:00
Russ Cox
1b3083e68d spec: clarify that f(g()) requires that g return >= 1 value
Fixes #4573.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7322043
2013-02-09 14:46:55 -05:00
Oling Cat
018e89fa69 doc/go_spec: remove extra space, align tags, and change a tab to a space.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7198048
2013-01-24 20:46:33 +11:00
Shenghou Ma
a0b5b46ae4 doc/go_spec: cap doesn't apply to maps
Fixes #4682.

R=golang-dev, adg, dave
CC=golang-dev
https://golang.org/cl/7094062
2013-01-22 03:18:20 +08:00
Robert Griesemer
d3679726b4 spec: clarify lhs syntax for range and select
Fixes #4653.

R=rsc, r, iant, ken, thakis
CC=golang-dev
https://golang.org/cl/7135058
2013-01-18 13:59:25 -08:00
Shenghou Ma
ced57153df doc/go_spec.html: clarification about insertion during map iteration
R=mdempsky, iant, r, gri, rsc, ken
CC=golang-dev
https://golang.org/cl/7100046
2013-01-17 23:11:25 +08:00
Robert Griesemer
f1cc0f44e3 spec: clarify short variable declaration corner cases
Fixes #4612.

R=rsc, iant, ken, r
CC=golang-dev
https://golang.org/cl/7076043
2013-01-09 11:31:32 -08:00
Robert Griesemer
c863db4e87 spec: s/char_lit/rune_lit/
The spec talks explicitly about rune literals but the
respective production is still called char_lit for
historic reasons. Updated the two occurences.

Fixes #4602.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/7070048
2013-01-07 18:02:58 -08:00
Matthew Dempsky
80a87a99cc spec: Use "non-negative" instead of "positive"
Replacing division-by-power-of-2 with right-shift is valid for
zero too.

R=gri
CC=golang-dev
https://golang.org/cl/7027049
2013-01-06 16:56:06 -08:00
Robert Griesemer
614b02d22a spec: clarify language about unary operator &
A composite literal may be parenthesized when
used as operand for the unary operator &.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
2013-01-02 18:11:49 -08:00
Robert Griesemer
462860bd8d spec: more explicit comments for constant expression examples
Fixes #3814.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6920057
2012-12-12 14:25:40 -08:00
Robert Griesemer
a9a49fe962 spec: calling delete on a nil map is a no-op
This is language change. It is a backward-compatible
change but for code that relies on a run-time panic
when calling delete on a nil map (unlikely).

Fixes #4253.

R=rsc, r, iant, ken, bradfitz, rogpeppe
CC=golang-dev
https://golang.org/cl/6909060
2012-12-12 13:08:35 -08:00
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
Robert Griesemer
103c9db747 spec: clarifications around exports, uniqueness of identifiers
- Define what it means for two identifiers to be unique.

- The current spec is incorrect about exported
identifiers: for instance, it excluded fields
of non-exported types of exported variables
from being exported. It is easier to leave
the detailed specification away and let the
rest of the spec govern access of exported
identifiers.

- The current spec is incorrect about qualified
identifiers: It simply required that an identifier
be exported to be valid in a qualified identifier.
However, qualified identifiers can only access
exported identifiers declared in the package
block of the imported package.

Fixes #1551.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/5711043
2012-03-01 13:57:49 -08:00
Robert Griesemer
953f2dec89 spec: minor tweaks
- more idiomatic examples of pointer types
- show use of _ in examples of function types
- remove "legal:" qualification in examples
  for consistency

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5711054
2012-03-01 10:35:15 -08:00
Stefan Nilsson
c50074e510 doc: add a bunch of missing <p> tags
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5707065
2012-02-29 15:07:52 -08:00
Russ Cox
8e38b17a90 spec: apply method sets, embedding to all types, not just named types
When we first wrote the method set definition, we had long
discussions about whether method sets applied to all types
or just named types, and we (or at least I) concluded that it
didn't matter: the two were equivalent points of view, because
the only way to introduce a new method was to write a method
function, which requires a named receiver type.

However, the addition of embedded types changed this.
Embedding can introduce a method without writing an explicit
method function, as in:

        var x struct {
                sync.Mutex
        }

        var px *struct {
                sync.Mutex
        }

        var _, _ sync.Locker = &x, px

The edits in this CL make clear that both &x and px satisfy
sync.Locker.  Today, gccgo already works this way; 6g does not.

R=golang-dev, gri, iant, r
CC=golang-dev
https://golang.org/cl/5702062
2012-02-29 15:54:06 -05:00
Russ Cox
0201e373e5 spec: shorten heading for complex, real, imag
In the current TOC it sticks out quite a bit.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5705053
2012-02-29 15:20:11 -05:00
Robert Griesemer
7c1cb37b55 spec: use the term "lexical token" (rather then "lexical symbol")
Fix for minor inconsistency.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5709058
2012-02-29 10:39:20 -08:00
Robert Griesemer
da633714fd spec: fix sentence
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5706065
2012-02-29 09:06:05 -08:00
Robert Griesemer
2c9e1637d2 go spec: inside functions, variables must be evaluated.
Fixes #1612.

R=r, rsc, iant, ken, remyoudompheng, ken, r
CC=golang-dev
https://golang.org/cl/5700068
2012-02-28 17:44:24 -08:00
Russ Cox
fad10f9c1c spec: allow disallow of \uFFFD in import path
Turns out U+FFFD is a graphic character too.

http://play.golang.org/p/YblCfKAfko

R=gri
CC=golang-dev
https://golang.org/cl/5699052
2012-02-23 22:46:04 -05:00
Robert Griesemer
ac4055b2c5 go spec: import path implementation restriction
R=rsc, r, r, adg
CC=golang-dev
https://golang.org/cl/5688074
2012-02-22 23:51:25 -08:00
Rob Pike
818e3cdb09 spec: refine the wording about variables in type switches
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5686064
2012-02-22 16:25:55 +11:00
Russ Cox
9c08d65084 spec: make all comparison results untyped bool
Or, depending on your point of view, make the
comparisons satisfy any surrounding boolean type.

Also, fix a few foo_bar -> fooBar in code fragments.

Fixes #2561.

R=golang-dev, r, bradfitz, gri, iant, kevlar
CC=golang-dev
https://golang.org/cl/5671096
2012-02-21 22:04:30 -05:00
Robert Griesemer
3908467b1f go spec: struct comparison only compares non-blank fields
Fixes #3031.

R=golang-dev, rsc, r, iant
CC=golang-dev
https://golang.org/cl/5676054
2012-02-16 14:13:17 -08:00
Ian Lance Taylor
9126c6570c spec: clarify implementation restrictions on untyped floats
Drop reference to "machine type."  Specify that integer
overflow must be an error.  Drop requirement that exponent
must be 128 bits--that's a lot.  Clarify that floating point
expressions may be rounded, including intermediate values.

This is a reworking of https://golang.org/cl/5577068/ .

Fixes #2789.

R=r, rsc, r, gri, ken, ken, iant
CC=golang-dev, remyoudompheng
https://golang.org/cl/5655049
2012-02-13 11:25:56 -08:00
Rob Pike
7bd6ebb104 spec: strings are more slices than arrays
Thanks to Aaron Kemp for noticing.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5645097
2012-02-13 23:39:56 +11:00
Robert Griesemer
b1d9ae9406 go spec: method names must be unique
Fixes #2916.

R=golang-dev, remyoudompheng, r, rsc
CC=golang-dev
https://golang.org/cl/5652064
2012-02-12 20:03:30 -08:00
Rob Pike
8040f9bb86 spec: typographical adjustment for ellipsis
The paragraph describing the ellipses presents the horizontal ellipsis
in two different fonts and at least on my screen they look too different.
Switch to a consistent rendering.

Of small steps are great journeys undertaken.

R=golang-dev, rsc, dsymonds, gri
CC=golang-dev
https://golang.org/cl/5650055
2012-02-13 14:38:31 +11:00
Russ Cox
7c5d6409f5 spec: address CL 5647054 comments
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5641057
2012-02-08 15:37:58 -05:00
Russ Cox
e7a138b856 spec: send on closed channel counts as "proceeding"
Other wordings are possible but defining this as one
of the ways to proceed means we don't have to add
language about this to the description of select.

Fixes #2825.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5643062
2012-02-08 15:24:48 -05:00
Russ Cox
388816ae07 spec: disallow recursive embedded interfaces
Fixes #1814.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5647054
2012-02-08 14:35:00 -05:00
Russ Cox
fd2a511253 spec: add forward links from 'method set' to where it gets used
Fixes #1797.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5645058
2012-02-08 14:28:51 -05:00
Rob Pike
fc06cadd88 go_spec: primality is elusive
This time for sure.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5634046
2012-02-07 06:59:36 +11:00
Christopher Wedgwood
6513e19532 spec: correct primes
R=r
CC=golang-dev
https://golang.org/cl/5627048
2012-02-04 10:34:31 +11:00
Rob Pike
a044154a4c spec: restore primality
9 is prime if it's a hot day.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5630043
2012-02-04 06:16:02 +11:00
Russ Cox
c739dd2299 spec: 9 only looks prime
Fixes #2870.

R=golang-dev, agl, lvd
CC=golang-dev
https://golang.org/cl/5618050
2012-02-03 10:30:52 -05:00
Robert Griesemer
9c3d876db1 go/spec: Update language on map types.
Fixes #2803.

R=r
CC=golang-dev
https://golang.org/cl/5601053
2012-01-30 15:31:33 -08:00
Rob Pike
633a2ce096 spec: function invocation, panic on *nil
Document that indirection through a nil pointer will panic.
Explain function invocation.
This section will need more work, but it's a start.

Fixes #1865.
Fixes #2252.

R=rsc, iant, r
CC=golang-dev
https://golang.org/cl/5532114
2012-01-23 08:40:13 -08:00
Andrew Gerrand
7cb21a79a4 godoc: specify HTML page metadata with a JSON blob
This allows HTML pages to specify arbitrary data in a header:

<!--{
        "Title": "The page title",
        ...
}-->

replacing the old style comments:

<!-- title The page title -->

R=gri, rsc, r, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5532093
2012-01-19 11:24:54 +11:00
Rob Pike
5f7337769c spec: change the wording regarding select statement choice
s/pseudo-random fair/uniform pseudo-random/
This careful word choice soothes the theoretically inclined.

R=golang-dev, rsc, gri
CC=golang-dev
https://golang.org/cl/5528098
2012-01-13 13:38:36 -08:00
Robert Griesemer
1320ce00c4 spec: pointer comparison for pointers to 0-sized variables
- define "0-sized"
- add clarifying sentence to pointer comparison
- removed notion "location" which was used only in pointer comparisons
  and which was never defined

Fixes #2620.

R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/5528053
2012-01-09 16:54:24 -08:00
Robert Griesemer
11b7c89b26 go spec: be precise about newlines
Several places mentioned tokens spanning "multiple lines"
which is not a well-defined term in the spec; newline is.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5490046
2011-12-15 10:51:51 -08:00
Rob Pike
c26ca912e5 spec: skip carriage returns in raw literals
This change guarantees that whether the line ending convention
when the source is created includes carriage returns is irrelevant
to the value of the string. See issue 680.

The compilers do not yet implement this.

R=golang-dev, adg, r, gri, rsc, iant
CC=golang-dev
https://golang.org/cl/5491043
2011-12-14 21:52:41 -08:00
Robert Griesemer
599c18fa3f spec: values of underlying type uintptr can be converted to unsafe.Pointer
Not a language change, just stating the facts.

Fixes #1793.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5488071
2011-12-13 17:22:11 -08:00
Russ Cox
83f648c962 spec: allow comparison of structs, arrays containing comparable values
Also, clarify when interface comparison panics and
that comparison to nil is a special syntax rather than
a general comparison rule.

R=r, gri, r, iant, cw, bradfitz
CC=golang-dev
https://golang.org/cl/5440117
2011-12-12 22:21:46 -05:00
Robert Hencke
1084ab98b7 spec: adjust complex constant example
Fixes https://golang.org/cl/5444053/#msg41

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5478058
2011-12-10 10:04:33 -08:00
Russ Cox
ef1c535727 spec: examples of untyped boolean, string constants
This is a spec correction, not a language change.
The implementations have behaved like this for years
(and there are tests to that effect), and elsewhere in
the spec true and false are defined to be untyped
boolean constants.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5477047
2011-12-09 00:13:19 -05:00
Russ Cox
6a47bb4974 spec: remove redundant, outdated definition of default literal types
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5480047
2011-12-09 00:12:49 -05:00
Russ Cox
d7f050a73e spec: rune is now an alias for int32
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5467048
2011-12-09 00:11:43 -05:00
Charles L. Dorian
9a358df947 spec: fix typo in example comment
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5475046
2011-12-08 22:27:14 -05:00
Russ Cox
a933635579 spec: var x = 'a' defaults to type rune
R=gri, r, r, adg, iant, ken
CC=golang-dev
https://golang.org/cl/5444053
2011-12-08 21:48:19 -05:00
Russ Cox
98553f1422 spec: remove contentious composite literal shortening
R=gri, r, gustavo, r
CC=golang-dev
https://golang.org/cl/5451099
2011-12-05 14:22:23 -05:00
Russ Cox
5f49456465 spec: additional composite literal shortenings per Go 1 plan
R=golang-dev, gri, r, r
CC=golang-dev
https://golang.org/cl/5449067
2011-12-02 14:12:53 -05:00
Russ Cox
8a8445ba71 spec: pointer to array can be sliced
This has always been true, but we lost it from the spec
somewhere along the way, probably when we disallowed
the general 'pointer to anything sliceable' slice case.

R=gri
CC=golang-dev
https://golang.org/cl/5437121
2011-12-02 13:11:30 -05:00
Russ Cox
4dfe976d97 spec: avoid slice of array literal
R=gri
CC=golang-dev
https://golang.org/cl/5451078
2011-12-02 12:30:20 -05:00
David Symonds
72a2979ef0 spec: update spacing to match gofmt, where reasonable.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/5327053
2011-11-29 15:47:36 -08:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Russ Cox
d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
Russ Cox
efb74460c3 spec: disallow general func, map comparisons
R=golang-dev, gri, r, r
CC=golang-dev
https://golang.org/cl/5369090
2011-11-13 22:57:45 -05:00
Rob Pike
217408abf3 crypto: update incorrect references to Cipher interface; should be Block.
R=gri, rsc, r
CC=golang-dev
https://golang.org/cl/5372050
2011-11-09 14:22:44 -08:00
Rob Pike
e223eedc8b spec: delete spurious article
A profound change to christen the new tag.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5327062
2011-11-01 20:57:17 -07:00
Russ Cox
d9877e22fe spec: add error
R=golang-dev, dsymonds, r, r
CC=golang-dev
https://golang.org/cl/5308072
2011-11-01 21:45:02 -04:00
Charles L. Dorian
44262d1574 doc: fix typo in spec example code comment
R=r, golang-dev, adg
CC=golang-dev
https://golang.org/cl/5308071
2011-11-01 15:13:33 +09:00
Robert Griesemer
b910a27396 go spec: introduce rune type
R=r, iant, rsc, r
CC=golang-dev
https://golang.org/cl/5293048
2011-11-01 01:09:22 -04:00
Russ Cox
b7ef3c9a54 spec: define that initialization is sequential
This is true of the existing implementations, and I think
it is an important property to guarantee.

R=golang-dev, r, borman, r
CC=golang-dev
https://golang.org/cl/5321058
2011-10-27 12:22:45 -07:00
Russ Cox
e40d6e066a runtime: random offset for map iteration
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5285042
2011-10-17 18:49:02 -04:00
Robert Griesemer
c5a6b05ba4 go spec: clarifying variable declaractions w/ constants
Fixes #2377.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5267048
2011-10-17 12:54:18 -07:00
Robert Griesemer
3e0c0a8add go spec: "delete" built-in function
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5272045
2011-10-17 12:53:10 -07:00
Russ Cox
f58ed4e641 gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
2011-10-13 16:58:04 -04:00
Russ Cox
d1bafffa4b runtime: run goroutines during init
Fixes #583.
Fixes #1776.
Fixes #2001.
Fixes #2112.

R=golang-dev, bradfitz, r, gri
CC=golang-dev
https://golang.org/cl/5265044
2011-10-13 15:54:23 -04:00
Russ Cox
fa538114ed spec: define order of multiple assignment
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5240055
2011-10-13 15:44:17 -04:00
Luuk van Dijk
77fac21e82 runtime: append([]byte, string...)
Fixes #2274

R=rsc, gri, dsymonds, bradfitz, lvd
CC=golang-dev
https://golang.org/cl/5149045
2011-10-12 15:59:23 +02:00
Ian Lance Taylor
807eb29f9f go spec: remove notes about gccgo limitations, now fixed
R=gri
CC=golang-dev
https://golang.org/cl/5164041
2011-09-29 14:50:55 -07:00
Robert Griesemer
ffe70eaa3c go spec: update section on Implementation Differences
R=rsc, r
CC=golang-dev
https://golang.org/cl/4977046
2011-08-31 15:16:51 -07:00
Robert Griesemer
38a53c7ecb go spec: (up-)date
R=rsc, bradfitz, r
CC=golang-dev
https://golang.org/cl/4738042
2011-07-14 15:58:37 -07:00
Russ Cox
58e19aa4cb go: require { } around else block
R=gri, ken, r
CC=golang-dev
https://golang.org/cl/4721044
2011-07-14 17:15:52 -04:00
Russ Cox
f4c7db0ed9 spec: disallow goto into blocks
R=gri, r, r
CC=golang-dev
https://golang.org/cl/4631045
2011-06-17 12:49:04 -04:00
Robert Griesemer
2769356dda go spec: specify constant conversions
This is not a language change.

Added paragraphs specifying which conversions
yield results that are constants.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/4515176
2011-06-13 16:47:33 -07:00
Robert Griesemer
eee70b07c1 go spec: unsafe.Alignof/Offsetof/Sizeof return uintptr
This is (indirectly) a language change. Per e-mail discussion
on golang-dev.

Fixes #1943.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/4581058
2011-06-13 16:46:42 -07:00
Robert Griesemer
95b8137a16 go spec: clarify rules for append, scope rules for :=
Fixes #1936.
Fixes #1940.

R=rsc, r, iant, ken, iant
CC=golang-dev
https://golang.org/cl/4585049
2011-06-12 12:09:50 -07:00
Robert Griesemer
636c5fac2d go spec: handle a corner case of a special case for shifts...
- Added some additional examples.
- 6g appears to implement this semantics already.

Fixes #658.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/4538119
2011-06-08 09:11:18 -07:00
Rob Pike
2f655c4bb7 spec: delete spurious tag.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4536082
2011-05-25 10:58:58 +10:00
Robert Griesemer
3c7271f057 go spec: be precise with the use of the informal ellipsis … and the Go token ...
Fixes #1867.

R=r
CC=golang-dev
https://golang.org/cl/4538092
2011-05-24 14:18:44 -07:00
Rob Pike
46f482a2fc docs: remove some prose-unworthy empty parentheses.
In our evolving style, prose should name a function "f" not "f()".

R=gri, rsc
CC=golang-dev
https://golang.org/cl/4550075
2011-05-25 06:44:09 +10:00
Rob Pike
bdbe0decc6 spec: add missing comma.
A real humdinger.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4538089
2011-05-25 06:00:07 +10:00
Robert Griesemer
32d127823f go spec: clarify rules for shifts
Note: This is not a spec change.

The spec was not clear on the result type of
constant shift expressions. Made it more
explicit and added additional examples.

Also: Remove paragraph on send expressions (they
are statements, now).

Fixes #1708.

R=rsc, r, iant, r
CC=golang-dev
https://golang.org/cl/4517074
2011-05-23 14:12:42 -07:00
Nigel Tao
703b092779 spec: fix copy to return "number of elements copied", not "number
of arguments copied".

R=gri, r
CC=golang-dev
https://golang.org/cl/4550041
2011-05-15 16:04:37 -07:00
Robert Griesemer
32b822f29a go spec: fix error in production syntax
Fix analoguous error in ebnf.go which already
correctly accepted an empty production.

Fixes #1821.

R=r
CC=golang-dev
https://golang.org/cl/4526056
2011-05-13 12:54:51 -07:00
Robert Griesemer
5473103666 go spec: clarify semantics of range clause
This CL proposes some subtle language changes
in an attempt to clarify the semantics of range
clauses and simplify uses of maps.

- nil maps behave like empty maps; but attempting
  to set a value in a nil map causes a run-time panic
- nil channels are never ready for communication;
  sending or reading from a nil channel blocks forever
- if there is only one index iteration variable in a
  range clause and len(range expression) would be a constant,
  the range expression is not evaluated.
  (was discrepancy with len/cap before)
- the notion of what is a constant expression len(x)
  for (pointer to) arrays x has been generalized and
  simplified (can still be syntactically decided)
  (before: more restrictive syntactic rule that was not
  consistently implemented)

Fixes #1713.

R=r, rsc, iant, ken2, r2, bradfitz, rog
CC=golang-dev
https://golang.org/cl/4444050
2011-05-12 09:15:59 -07:00
Rob Pike
38d7bcf5e2 go spec: fix up HTML glitches.
Fixes #1786.

R=gri, adg
CC=golang-dev
https://golang.org/cl/4517043
2011-05-08 14:05:18 -07:00
Robert Griesemer
0e8032ca49 go spec: newlines cannot be used inside a char or "" string literal
R=r
CC=golang-dev
https://golang.org/cl/4462043
2011-05-05 09:03:00 -07:00
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