spec: define "variable" as in current use
Note that we have sections on constant, type, variable,
and function declarations; and we have sections on constants,
types, and packages, but none on variables and functions.
The latter (functions) is still a pending TODO.
Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to ...
9 years, 6 months ago
(2014-10-04 00:34:22 UTC)
#1
Please wait w/ reviewing this CL. After rereading the section on comparisons, I think the ...
9 years, 6 months ago
(2014-10-04 04:37:49 UTC)
#2
Please wait w/ reviewing this CL. After rereading the section on
comparisons, I think the new version is worse than what was there before.
- gri
On Fri, Oct 3, 2014 at 5:34 PM, <gri@golang.org> wrote:
> Reviewers: r, rsc, iant, ken2,
>
> Message:
> Hello r@golang.org, rsc@golang.org, iant@golang.org, ken@golang.org (cc:
> golang-codereviews@googlegroups.com),
>
> I'd like you to review this change to
> https://code.google.com/p/go/
>
>
> Description:
> spec: remove notion of "interface value", define "variable"
>
> The section on comparisons uses the notion of
> an "interface value" which is misleading since
> there are no value of type interface, only
> variables (and function results) of type interface.
> Attempt to clarify this.
>
> In the process, define what a variable is and use that
> notion systematically through-out.
>
> (Note that we have sections on constant, type, variable,
> and function declarations; and we have sections on constants,
> types, and packages, but none on variables and functions.
> The latter (functions) is still a pending TODO).
>
> This is not a language change.
>
> Fixes issue 8150.
>
> Please review this at https://codereview.appspot.com/149360043/
>
> Affected files (+116, -63 lines):
> M doc/go_spec.html
>
>
>
I agree that this is the kind of thing the spec usually means by variable, ...
9 years, 6 months ago
(2014-10-06 14:31:48 UTC)
#4
I agree that this is the kind of thing the spec usually means by variable, but I
am not sure it is a complete definition. What about individual struct fields, or
elements of an array or slice? Aren't those variables too in this sense? And
what about variables of type struct{} or [0]int?
I've never been completely comfortable with the overloading of variable in this
sense. I wonder if we should reserve variable for what 'var' and ':=' introduce
and use a different word (or none at all, if we can) for unnamed storage.
Given the earlier discussion on this CL about 'interface values' and the pinned
original email subject also mentioning interface values, I think it might make
sense to delete this CL and create a new one for the discussion of what a
variable is.
https://codereview.appspot.com/149360043/diff/230001/doc/go_spec.html
File doc/go_spec.html (right):
https://codereview.appspot.com/149360043/diff/230001/doc/go_spec.html#newcode659
doc/go_spec.html:659: A <a href="#Variable_declarations">Variable
declaration</a>,
s/V/v/
Sure, I will create a new CL. Just for the record, the spec always regarded ...
9 years, 6 months ago
(2014-10-06 16:11:26 UTC)
#5
Sure, I will create a new CL.
Just for the record, the spec always regarded array elements and struct
fields as variables, even w/o my change:
"A pointer type denotes the set of all pointers to variables of a given
type" (http://tip.golang.org/ref/spec#Pointer_types)
I can create a pointer to an array element, et voilá!
I didn't want to the emphasize it more, but it's always been there; and
ironically that line was written or last touched by r.
- gri
On Mon, Oct 6, 2014 at 7:31 AM, <rsc@golang.org> wrote:
> I agree that this is the kind of thing the spec usually means by
> variable, but I am not sure it is a complete definition. What about
> individual struct fields, or elements of an array or slice? Aren't those
> variables too in this sense? And what about variables of type struct{}
> or [0]int?
>
> I've never been completely comfortable with the overloading of variable
> in this sense. I wonder if we should reserve variable for what 'var' and
> ':=' introduce and use a different word (or none at all, if we can) for
> unnamed storage.
>
> Given the earlier discussion on this CL about 'interface values' and the
> pinned original email subject also mentioning interface values, I think
> it might make sense to delete this CL and create a new one for the
> discussion of what a variable is.
>
>
>
> https://codereview.appspot.com/149360043/diff/230001/doc/go_spec.html
> File doc/go_spec.html (right):
>
> https://codereview.appspot.com/149360043/diff/230001/doc/
> go_spec.html#newcode659
> doc/go_spec.html:659: A <a href="#Variable_declarations">Variable
> declaration</a>,
> s/V/v/
>
> https://codereview.appspot.com/149360043/
>
And just for the record, I always thought that was odd terminology, but realized I ...
9 years, 6 months ago
(2014-10-06 16:26:26 UTC)
#6
And just for the record, I always thought that was odd terminology,
but realized I come from the C tradition with l-values and r-values.
-rob
On Mon, Oct 6, 2014 at 9:11 AM, Robert Griesemer <gri@golang.org> wrote:
> Sure, I will create a new CL.
>
> Just for the record, the spec always regarded array elements and struct
> fields as variables, even w/o my change:
>
> "A pointer type denotes the set of all pointers to variables of a given
> type" (http://tip.golang.org/ref/spec#Pointer_types)
>
> I can create a pointer to an array element, et voilá!
>
> I didn't want to the emphasize it more, but it's always been there; and
> ironically that line was written or last touched by r.
>
> - gri
>
>
>
> On Mon, Oct 6, 2014 at 7:31 AM, <rsc@golang.org> wrote:
>>
>> I agree that this is the kind of thing the spec usually means by
>> variable, but I am not sure it is a complete definition. What about
>> individual struct fields, or elements of an array or slice? Aren't those
>> variables too in this sense? And what about variables of type struct{}
>> or [0]int?
>>
>> I've never been completely comfortable with the overloading of variable
>> in this sense. I wonder if we should reserve variable for what 'var' and
>> ':=' introduce and use a different word (or none at all, if we can) for
>> unnamed storage.
>>
>> Given the earlier discussion on this CL about 'interface values' and the
>> pinned original email subject also mentioning interface values, I think
>> it might make sense to delete this CL and create a new one for the
>> discussion of what a variable is.
>>
>>
>>
>> https://codereview.appspot.com/149360043/diff/230001/doc/go_spec.html
>> File doc/go_spec.html (right):
>>
>>
>>
https://codereview.appspot.com/149360043/diff/230001/doc/go_spec.html#newcode659
>> doc/go_spec.html:659: A <a href="#Variable_declarations">Variable
>> declaration</a>,
>> s/V/v/
>>
>> https://codereview.appspot.com/149360043/
>
>
Issue 149360043: code review 149360043: spec: define "variable" as in current use
(Closed)
Created 9 years, 6 months ago by gri
Modified 9 years, 6 months ago
Reviewers: r, rsc, iant, ken2
Base URL:
Comments: 1