Commit 9b49ac03 authored by Robert Griesemer's avatar Robert Griesemer

spec: consistently use "defined type" and "type name" (cleanup)

When we introduced the notion of alias type declarations, we renamed
"named type" to "defined type" to avoid confusion with types denoted
by aliases and thus are also types with names, or "named types".

Some of the old uses of "named types" remained; this change removes
them.

Now the spec consistently uses the terms:

- "defined type"  for a type declared via a type definition
- "type name"     for any name denoting an (alias or defined) type
- "alias"         for a type name declared in an alias declaration

New prose is encouraged to avoid the term "named type" to counter-
act further confusion.

Fixes #23474.

Change-Id: I5fb59f1208baf958da79cf51ed3eb1411cd18e03
Reviewed-on: https://go-review.googlesource.com/89115Reviewed-by: 's avatarRob Pike <r@golang.org>
parent cafb36bf
<!--{ <!--{
"Title": "The Go Programming Language Specification", "Title": "The Go Programming Language Specification",
"Subtitle": "Version of January 17, 2018", "Subtitle": "Version of January 23, 2018",
"Path": "/ref/spec" "Path": "/ref/spec"
}--> }-->
...@@ -694,9 +694,8 @@ TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType ...@@ -694,9 +694,8 @@ TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType
</pre> </pre>
<p> <p>
Named instances of the boolean, numeric, and string types are The language <a href="#Predeclared_identifiers">predeclares</a> certain type names.
<a href="#Predeclared_identifiers">predeclared</a>. Others are introduced with <a href="#Type_declarations">type declarations</a>.
Other named types are introduced with <a href="#Type_declarations">type declarations</a>.
<i>Composite types</i>&mdash;array, struct, pointer, function, <i>Composite types</i>&mdash;array, struct, pointer, function,
interface, slice, map, and channel types&mdash;may be constructed using interface, slice, map, and channel types&mdash;may be constructed using
type literals. type literals.
...@@ -1025,8 +1024,8 @@ of a struct except that they cannot be used as field names in ...@@ -1025,8 +1024,8 @@ of a struct except that they cannot be used as field names in
</p> </p>
<p> <p>
Given a struct type <code>S</code> and a type named <code>T</code>, Given a struct type <code>S</code> and a <a href="#Type_definitions">defined type</a>
promoted methods are included in the method set of the struct as follows: <code>T</code>, promoted methods are included in the method set of the struct as follows:
</p> </p>
<ul> <ul>
<li> <li>
...@@ -2643,8 +2642,8 @@ expression is illegal. ...@@ -2643,8 +2642,8 @@ expression is illegal.
</li> </li>
<li> <li>
As an exception, if the type of <code>x</code> is a named pointer type As an exception, if the type of <code>x</code> is a <a href="#Type_definitions">defined</a>
and <code>(*x).f</code> is a valid selector expression denoting a field pointer type and <code>(*x).f</code> is a valid selector expression denoting a field
(but not a method), <code>x.f</code> is shorthand for <code>(*x).f</code>. (but not a method), <code>x.f</code> is shorthand for <code>(*x).f</code>.
</li> </li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment