Skip to content

Commit

Permalink
spec: define notion of named type
Browse files Browse the repository at this point in the history
The notion of a named type is crucial for the definition
of type identity, assignability, definitions of methods.
Explicitly introduce the notion with an extra sentence.

Fixes #5682.

R=r, rsc, iant
CC=golang-dev
https://golang.org/cl/11055043
  • Loading branch information
griesemer committed Jul 10, 2013
1 parent d178c01 commit 8268ead
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of June 21, 2013",
"Subtitle": "Version of July 9, 2013",
"Path": "/ref/spec"
}-->

Expand Down Expand Up @@ -640,10 +640,10 @@ <h2 id="Types">Types</h2>

<p>
A type determines the set of values and operations specific to values of that
type. A type may be specified by a
(possibly <a href="#Qualified_identifiers">qualified</a>)
<a href="#Type_declarations"><i>type name</i></a> or a <i>type literal</i>,
which composes a new type from previously declared types.
type. Types may be <i>named</i> or <i>unnamed</i>. Named types are specified
by a (possibly <a href="#Qualified_identifiers">qualified</a>)
<a href="#Type_declarations"><i>type name</i></a>; unnamed types are specified
using a <i>type literal</i>, which composes a new type from existing types.
</p>

<pre class="ebnf">
Expand Down Expand Up @@ -1358,9 +1358,9 @@ <h3 id="Type_identity">Type identity</h3>
</p>

<p>
Two named types are identical if their type names originate in the same
Two <a href="#Types">named types</a> are identical if their type names originate in the same
<a href="#Type_declarations">TypeSpec</a>.
A named and an unnamed type are always different. Two unnamed types are identical
A named and an <a href="#Types">unnamed type</a> are always different. Two unnamed types are identical
if the corresponding type literals are identical, that is, if they have the same
literal structure and corresponding components have identical types. In detail:
</p>
Expand Down Expand Up @@ -1442,7 +1442,7 @@ <h3 id="Assignability">Assignability</h3>
<li>
<code>x</code>'s type <code>V</code> and <code>T</code> have identical
<a href="#Types">underlying types</a> and at least one of <code>V</code>
or <code>T</code> is not a named type.
or <code>T</code> is not a <a href="#Types">named type</a>.
</li>
<li>
<code>T</code> is an interface type and
Expand Down

0 comments on commit 8268ead

Please sign in to comment.