1
0
mirror of https://github.com/golang/go synced 2024-09-24 07:10:12 -06:00

spec: clean up intro and replace bolded text with prose

- Remove "Draft" disclaimer. We're not done but the spec
  is in usable shape with respect to generics features.

- Remove section on "Earlier version" and fold information
  into the "Intro" section.

- Remove caveat for shifts: the rules for arithmetic operators
  on type parameters apply for them as well.

- Simply state that we don't support arguments of type parameter
  type for the built-ins real, imag, and complex.

Fixes #51182.

Change-Id: I6df1427de685cfe7055b64e91753aa7ebff70565
Reviewed-on: https://go-review.googlesource.com/c/go/+/391695
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Robert Griesemer 2022-03-09 18:36:53 -08:00
parent 751b8798dd
commit 59d80227ef

View File

@ -1,21 +1,16 @@
<!--{
"Title": "The Go Programming Language Specification - Go 1.18 Draft",
"Subtitle": "Version of March 9, 2022",
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of March 10, 2022",
"Path": "/ref/spec"
}-->
<h2>Earlier version</h2>
<p>
For the pre-Go1.18 specification without generics support see
<a href="/doc/go1.17_spec.html">The Go Programming Language Specification</a>.
</p>
<h2 id="Introduction">Introduction</h2>
<p>
This is a reference manual for the Go programming language. For
more information and other documents, see <a href="/">golang.org</a>.
This is the reference manual for the Go programming language.
The pre-Go1.18 version, without generics, can be found
<a href="/doc/go1.17_spec.html">here</a>.
For more information and other documents, see <a href="/">golang.org</a>.
</p>
<p>
@ -4668,10 +4663,6 @@ and the other operand is not, the constant is implicitly <a href="#Conversions">
to the type of the other operand.
</p>
<p><b>
[The rules for shifts need adjustments for type parameters. Issue #51182.]
</b></p>
<p>
The right operand in a shift expression must have <a href="#Numeric_types">integer type</a>
or be an untyped constant <a href="#Representability">representable</a> by a
@ -7257,10 +7248,6 @@ does not exist, <code>delete</code> is a no-op.
<h3 id="Complex_numbers">Manipulating complex numbers</h3>
<p><b>
[We don't support generic arguments for these built-ins for Go 1.18.]
</b></p>
<p>
Three functions assemble and disassemble complex numbers.
The built-in function <code>complex</code> constructs a complex
@ -7323,6 +7310,10 @@ const c = imag(b) // untyped constant -1.4
_ = imag(3 &lt;&lt; s) // illegal: 3 assumes complex type, cannot shift
</pre>
<p>
Arguments of type parameter type are not permitted.
</p>
<h3 id="Handling_panics">Handling panics</h3>
<p> Two built-in functions, <code>panic</code> and <code>recover</code>,