Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: similar sounding nomenclature is confusing #4532

Closed
griesemer opened this issue Dec 12, 2012 · 5 comments
Closed

spec: similar sounding nomenclature is confusing #4532

griesemer opened this issue Dec 12, 2012 · 5 comments

Comments

@griesemer
Copy link
Contributor

In the spec we use the following phrases:

1) integer value
2) value of integer type
3) value of type int (or int8, int16, etc)
4) representable as a value of type int (or int8, int16, etc)

They are very similar in English but mean different things in the spec:

1) -> a (typed or untyped) constant value that is integer (1, 2.0, -4.0 + 0i)
2) -> a typed value that has one of the signed/unsigned integer types (byte, int,
uint8, etc.)
3) -> a value of a concrete type int, int8, etc.
4) -> a value that can be represented w/o loss of accuracy as a value of a specific
type

We should clean this up, and/or introduce a section explaining the nomenclature. As is,
the English differences are small, but the spec implications are large.
@griesemer
Copy link
Contributor Author

Comment 1:

https://golang.org/cl/6903048/ is an example where this came up: The section on
array types says:
The length is part of the array's type; it must evaluate to a non-negative constant
representable by a value of type int.
r prefers if this would say:
The length is part of the array's type; it must evaluate to a non-negative constant
representable by an int.
The former phrase (representable by a value of type int) was chosen for now since it's
the common phrasing used elsewhere.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@griesemer
Copy link
Contributor Author

  1. has been addressed with an explicit definition of "representability" (https://go-review.googlesource.com/57530)
  2. all uses of "value of type T" in the spec are very clear
  3. all uses of "value of integer type" in the spec are also clear (no ambiguities)
  4. all uses of "integer value" have been clarified over time - it's always a value of integer type or an untyped integer constant (never an untyped constant that is not an integer constant but happens to have an integer value, such as 1.0). Furthermore, the section on numeric types defines each set as a set of "integer or floating-point values" which defines the term.

Closing.

@golang golang locked and limited conversation to collaborators Aug 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants